PDA

Click to See Complete Forum and Search --> : Some help on acceleration...



RyanWest
09-05-2002, 04:43 AM
Hey I need some help with a car game I was making..
well the game really sucks without acceleration and deceleration...
Can anyone help me with the math part on that?

Simulating acceleration and deceleration
Anyhelp would be great
email is Ryan__west@hotmail.com

bit-101
09-05-2002, 10:03 AM
acc=.5;
vel=0;
car._x=0;
onEnterFrame=function(){
vel+=acc;
car._x+=vel;
}


simply add your acceleration to your velocity each frame, then add velocity to position. deceleration is just negative value for acceleration.