I have a movie clip that rotates with the left and right buttons and I'd like it to move it's relative forward and backward when up and down are pressed. I remember being able to do it but I just can't remember how.
hey its you!
its trigonometry. I can't remember exactly.
Assuming AS2:
if(Key.isDown(Key.UP)) {
_x += Math.cos(_rotation/180*Math.PI)*spd;
_y += Math.sin(_rotation/180*Math.PI)*spd;
}
if(Key.isDown(Key.DOWN)) {
_x -= Math.cos(_rotation/180*Math.PI)*Rspd;
_y -= Math.sin(_rotation/180*Math.PI)*Rspd;
}
I didn't check it but it should work, spd is a variable for speed and Rspd is a variable for reverse speed.