News:

If you need instructions on how to get through the hotels, check out the enclosed instruction book.

Main Menu

ActionScipt Help

Farted by Bong Clock, November 30, 2009, 08:40:59 PM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

Bong Clock

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.

TapedeckClock

WWWWWWWWWW

AmberArachnidClock

its trigonometry. I can't remember exactly.

BootClock

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.