Beginer is begging for asistence

Game Editor comments and discussion.

Beginer is begging for asistence

Postby shm » Sun Jun 09, 2013 5:34 pm

Hallo. I need advice from someone more experienced than i am. (should not be dificult to find here :) )

I try to create an action game with mouse aiming (Abuse style)
I would like to have aiming cross locked to circle (vis picture) no matter where mouse is positioned, but still it shoud follow the angle. (i hope hope my english makes sense to you)
The cross also should have fixed distance to main char (blue blob)

Please help. I´m nod skilled enough to do this my self. I discovered G.editor only week ago. :oops:

With this big issue of mine, there is another question i would like to ask.
Is there any way to rotate actors animation directly by script?
There will be shot represented only by short line. (max 3 pixels wide) Making picture for every possible angle, whitch shot will fly, would be unnecessarily lengthy and too HD space intensive.

Thanks for your time.
Attachments
Vysvetlovaci obrazek.jpg
shm
 
Posts: 5
Joined: Fri Jun 07, 2013 8:37 am
Score: 0 Give a positive score

Re: Beginer is begging for asistence

Postby skydereign » Sun Jun 09, 2013 6:31 pm

shm wrote:I try to create an action game with mouse aiming (Abuse style)
I would like to have aiming cross locked to circle (vis picture) no matter where mouse is positioned, but still it shoud follow the angle. (i hope hope my english makes sense to you)
The cross also should have fixed distance to main char (blue blob)

I'm not entirely sure if this is what you mean, your picture isn't all that clear, but if you want a crosshair to be at some distance away from an actor, and in the angle of the mouse, you can do this.
crosshair -> Draw Actor -> Script Editor
Code: Select all
double ang = degtorad(direction(player.xscreen, player.yscreen, xmouse, ymouse));
int radius = 200;
xscreen = player.xscreen + cos(ang)*radius;
yscreen = player.yscreen - sin(ang)*radius;

shm wrote:With this big issue of mine, there is another question i would like to ask.
Is there any way to rotate actors animation directly by script?
There will be shot represented only by short line. (max 3 pixels wide) Making picture for every possible angle, whitch shot will fly, would be unnecessarily lengthy and too HD space

In the current version of gE, no, you can't rotate actors via script. And you don't necessarily need to make a frame for every angle, sometimes you just need 8 angles, or 16.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Beginer is begging for asistence

Postby shm » Tue Jun 11, 2013 11:38 am

Thank you a lot.
This solves half of the problem. Crosshair orbits main char as i want, but do not follow position of mouse. Crosshair starts to rapidly change position around main char with every slight move of mouse or main char movement.
Do you know why is that and what to do with it? ´couse i not... :(
shm
 
Posts: 5
Joined: Fri Jun 07, 2013 8:37 am
Score: 0 Give a positive score

Re: Beginer is begging for asistence

Postby lcl » Tue Jun 11, 2013 12:17 pm

It's because GE's trigonometric functions require the values given as radians, not degrees.
So, you should use degtorad() to convert ang-variable, which is in degrees, to radians. Result code would be this:
Code: Select all
double ang = direction(player.xscreen, player.yscreen, xmouse, ymouse);
int radius = 200;
xscreen = player.xscreen + cos(degtorad(ang))*radius;
yscreen = player.yscreen - sin(degtorad(ang))*radius;
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Beginer is begging for asistence

Postby shm » Tue Jun 11, 2013 2:51 pm

Everything is fine now.

You have my thanks.
shm
 
Posts: 5
Joined: Fri Jun 07, 2013 8:37 am
Score: 0 Give a positive score

Re: Beginer is begging for asistence

Postby shm » Fri Jun 14, 2013 10:09 pm

Time past and i encountered another problem. I will be grateful if someone can help me with that too.
This time its the Physical Response. I used it to my Collision_Tiles which represents solid ground and celings in my game. But when i started to add animations i figured that Physical Response make them starts over and over again. (make it look lagy.) Also it slows x movement on ground.
I thought i can replace Physical Response with simple :

main_char -> collision (top side of Collision_Tiles)
Code: Select all
yvelocity = 0; //turns off falling
grav = 0; //turns off gravity
skok = 0; //jump enabled
skok_ini = 0; //special variable for animations during jump

Well... result is too unpredictable. Sometimes main char lands few pixels under top of tile. Sometimes it flew through it and blocks by next tile. I could never figure any legality.

And to the point. I need to do block falling directly on top of C_Tiles or max 1 pixel in them. Without using Physical Response of course.
I need to block bottom, left and right sides too, but if you help me with top. I can use it for rest.

I hope i mentioned everything vital.
Thanks a lot
shm
 
Posts: 5
Joined: Fri Jun 07, 2013 8:37 am
Score: 0 Give a positive score

Re: Beginer is begging for asistence

Postby skydereign » Mon Jun 17, 2013 6:42 pm

It sounds like you are using xvelocity for left/right movement. There are two fixes for this. One is to use x instead of xvelocity. For instance, putting the following in a keydown event that is set to repeat will do the same thing as setting xvelocity to 5 on key press.
Code: Select all
x+=5;
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Beginer is begging for asistence

Postby shm » Tue Jun 18, 2013 11:13 am

Yes, you´re right. I´m using velocities for all of my movements. Main char continuously speeds up and down as well as slows down during jump.

example of movement to right...
Push Down d
Code: Select all
    vel = 15;
    friction = 1; //friction off
    xvelocity = xvelocity +5;
    if (xvelocity >= vel) xvelocity = vel;

(yes its practicaly copied from tutorials :oops: )
Still... i would like to keep this system. Looks good.
I have theoretical idea for perfect solution for my problem, but i don´t know how to write it.

When main char collides with Collision_tiles, it should:
1) Stop the relevant velocity (x for right and left sides and y for top and bottom sides)
2) correct position of main char. (As i mentioned earlier, main char falls trough C_tiles some distance before it stops. My idea was to move it to the edge of C_tile, that he collided. I tried to refer to Collision_tiles.width/length, but this refer to whole shape, that is drawn by the tile. I don´t know how to refer to single tile, which is actualy collided.

Skydereign. Your advice is fine and easy, but i need something little more difficult. Yeah maybe i make too high demands for my first steps with programing on GE but thats just me :p
Still... I very appreciate your help and any help.
shm
 
Posts: 5
Joined: Fri Jun 07, 2013 8:37 am
Score: 0 Give a positive score

Re: Beginer is begging for asistence

Postby skydereign » Tue Jun 18, 2013 6:51 pm

shm wrote:Skydereign. Your advice is fine and easy, but i need something little more difficult.

That's all fine and good as long as there is a reason that the easy fix doesn't apply. Making things harder unnecessarily just causes grief. Now, the method you mentioned is the other easy fix to the problem. People use it for walls all the time, though it can apply to the ground, as shown.
player -> Collision with top side of tiles -> Script Editor
Code: Select all
double xvel = xvelocity;
PhysicalResponse(MOVE_EVENT_ACTOR_ONLY, USE_CALCULATED_MASS, 1.000000,1.000000, 0.000000, 0.000000);
xvelocity = xvel;

The PhysicalResponse will prevent it from moving through the actor, and it sets xvelocity back to the way it was before the collision.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest