• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM movement troubles

B

Benjamin Herne

Guest
I have a character, and the keys are thus: W, forward, S, back, A, left and D, right. This is based on the object's direction, and data for it's speed in contained in the variables fb_vel (w/s) amd rl_vel (a/d). They are then translated into x velocity and y velocity with the following code:
Code:
if direction >= 0 && direction < 90 {
    x_vel = fb_vel * cos(direction);
    y_vel = fb_vel * sin(direction);
}
if directionrl >= 270 && directionrl < 360 {
    x_vel += rl_vel * cos(360 - directionrl);
    y_vel += rl_vel * sin(360 - directionrl) * -1;
}
My problem is, that when I press A or D, it doesn't move left or right, it moves on a diagonal.
 
B

Benjamin Herne

Guest
Never mind, I realised that gamemaker works in radians for trig
 
Top