Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Realistic control of a car, the example is ActionScript 2 but can be applied in numerous other languages
- spd = 0;
- onEnterFrame = function(){
- car._y -= Math.cos(angle*Math.PI/180)*spd;
- car._x += Math.sin(angle*Math.PI/180)*spd;
- spd *= .9;
- angle = car._rotation;
- if(Key.isDown(Key.UP))spd += 1;
- else if(Key.isDown(Key.DOWN)) spd -= 1;
- if(Key.isDown(Key.LEFT)) car._rotation -= .5*spd;
- if(Key.isDown(Key.RIGHT)) car._rotation += .5*spd;
- if(spd < .5 & spd > -.5) spd = 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement