Basic movement-thrust-inertia?
-
in part of my game I want the control to be like the retro asteroids game. I got the rotate left-right working but I am lost on how to do the forward movement, I know it has to do with the rotation direction of the ship and I can read the rotation angle but how to convert that into a movement direction and how to keep moving afterwards. I have read the tutorials and looked at vectoids is that the name? in the programs but that is a different kind of movement and not what I want. how do I do it?
-
@Sgtelite78 try looking into some of the sample projects or there's a video on movement on the fuze youtube
-
Thanks but like I said I tried the tutorials but their movement is not the same as I wish to use. maybe it can be adapted but I dunno how.
-
Don't need it, working now. used some sin/cos with setspritespeed
-
Use sin and cos
Ie
New_velocity_x = sin ( ship_angle ) * thrust
New_velocity_y = cos ( ship_angle ) * thrust
Then add together your
Velocity_x =velocity_x + new_velocity_x
Velocity_y =velocity_y +new_velocity_y
Then add to your position
X_pos = x_pos + velocity_x
Y_pos = y_pos + velocity_y
Also don't let the velocity get to high or you'll zip straight off the screen -
@xevdev said in Basic movement-thrust-inertia?:
Use sin and cos
Ie
New_velocity_x = sin ( ship_angle ) * thrust
New_velocity_y = cos ( ship_angle ) * thrust
Then add together your
Velocity_x =velocity_x + new_velocity_x
Velocity_y =velocity_y +new_velocity_y
Then add to your position
X_pos = x_pos + velocity_x
Y_pos = y_pos + velocity_y
Also don't let the velocity get to high or you'll zip straight off the screenyour way is better than mine so I'm using it. it is perfect but one flaw and when I rotate the ship and then press thrust it does not slow down and then move in new direction it jerks-jumps. if not for that it would be arcade perfect!!
-
Thrust should be small .
I think when I made a similar game I had it accumulate to 10 then divided by 10 so it never got bigger than 1 -