flashtalk
Would you like to react to this message? Create an account in a few clicks or log in to continue.


Various talk about Flash related subjects
 
HomeLatest imagesSearchRegisterLog in

 

 Arrow Key Movement

Go down 
AuthorMessage
Admin
Admin
Admin
Admin


Number of posts : 4
Registration date : 2008-05-06

Arrow Key Movement Empty
PostSubject: Arrow Key Movement   Arrow Key Movement I_icon_minitimeWed May 07, 2008 4:38 pm


TUTORIAL ON ARROW KEY MOVEMENT(BASIC)
Alright, so first create your movie clip. We're gonna call ours "player_mc." Now, place an instance of it on the Stage and give it an instance name "player_mc." Next, click on that movie clip and in the Actions panel, type this in:

Code:

onClipEvent(enterFrame){
    if(Key.isDown(Key.DOWN)){
          this._y+=5;
    }if(Key,isDown(Key.UP)){
          this._y-=5;
    }if(Key.isDown(Key.LEFT)){
          this._x-=5;
    }if(Key.isDown(Key.RIGHT)){
          this._x+=5;
    }
}

That should give you a good foundation to build off of. It's a widely used method, however it is affected by frame rate. Good luck. Hopefully the next tutorial will be covering the hitTest() method.
Until next time,
cya.Like a Star @ heavenLike a Star @ heavenLike a Star @ heavenLike a Star @ heavenLike a Star @ heaven
Back to top Go down
https://flashnstuff.board-directory.net
 
Arrow Key Movement
Back to top 
Page 1 of 1
 Similar topics
-
» Demo for Arrow Key and hitTest() tutorials

Permissions in this forum:You cannot reply to topics in this forum
flashtalk :: Main :: Tutorials-
Jump to: