Thursday, March 20, 2008

Movements and hitTests

Figured out diagonal movement and a better method for arrow keys:

onClipEvent(enterFrame){
if(Key.isDown(Key.LEFT)){
_x -= 2;
}
}
//left arrow key moves the guy leftwards WHEN THE KEY IS DOWN as opposed to when it is pressed... which is much more jumpy.

Also:

onClipEvent(enterFrame){
if(Key.isDown(Key.LEFT) && Key.isDown(Key.UP)){
_x--;
_y--;
_rotation = 315;
}
}
//moves left AND up (and rotates the object 315 degrees so that it faces the top left of the screen

No comments: