a little physics help
Posted 31 October 2011 - 10:26 AM
Posted 31 October 2011 - 03:12 PM
Posted 31 October 2011 - 03:34 PM
As GM has the horizontal and vertical components of the velocity built in, using "s = ut + 0.5a(t)^2":
x = hspeed*t + xstart; y = vspeed*t + 0.5*G*(t)^2 + ystart;
Edit: It should work as long as the hspeed and vspeed don't change. You might want to store them in variables at the start just to make sure.
//Create or somewhere where you start to set its motion. vx = hspeed; vy = vspeed; //Step x = vx*t + xstart; y = vy*t + 0.5*G*(t)^2 + ystart;
Edit 2: This also assumes that gravity's facing downwards. It'll be a bit more complicated if it's not - You'll need to find the horizontal and vertical components of gravity and then put them in as acceleration. Also t is in seconds so you'll need to convert it to steps (room_speed = 1 second).
Edited by Panda_196, 31 October 2011 - 03:53 PM.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users