Reply to this topicStart new topicStart Poll

» Flash RPG movement, Part 1 in a series.
AwesomeDesign
Posted: Feb 12 2009, 10:36 PM
Quote Post




When I'm sad, I stop being sad and be awesome instead.
****

Group: Members
Posts: 302
Joined: 18-December 08
Member No.: 128



Warn: (0%) -----


Starting off you should go to properties, make sure nothing is selected and you have the regular selection tool[black arrow] on. Set the Frames Per Second[FPS] to the magical number of 31.

Alright first of make a player facing down. Now highlight it and press F8 on the window name it mc_player and make sure movie clip is selected.

Now click on him and a blue box will surround him. go to his properties and where it says instance name put "player" with no quotes.

Double Click him to enter inside of him and make 8 new keyframes. Click on each one and press F9 in the window type
CODE
stop();
This will stop each frame from playing.
now do as following for each frame.
Frame 1:
Make him facing down, not moving.
Frame 2:
Make him facing up, not moving.
Frame 3:
Make him facing left, not moving.
Frame 4:
Make him facing right not moving.
Frame 5:
Make a movie clip[explained above] and double click to get inside of it, animate him walking down.
Frame 6:
Make a movie clip[explained above] and double click to get inside of it, animate him walking up.
Frame 7:
Make a movie clip[explained above] and double click to get inside of it, animate him walking left.
Frame 8:
Make a movie clip[explained above] and double click to get inside of it, animate him walking right.

Now click on the button that says "Scene 1" under the timeline.


Now Click on him and press F9. in the window that opens type:
CODE

onClipEvent(enterFrame)
{
if(!Key.isDown(Key.UP))
{
_root.player.gotoAndStop(2);
}
}
onClipEvent(enterFrame)
{
if(!Key.isDown(Key.DOWN))
{
_root.player.gotoAndStop(1);
}
}
onClipEvent(enterFrame)
{
if(!Key.isDown(Key.LEFT))
{
_root.player.gotoAndStop(3);
}
}
onClipEvent(enterFrame)
{
if(!Key.isDown(Key.RIGHT))
{
_root.player.gotoAndStop(4);
}
}

This will check if you aren't pressing the arrow keys and send you to the corresponding frame for each one. DO NOT TEST IT YET!!!
_root refers to the main timeline, .player means the player movie clips timeline.

I forgot something, before all the last events put.
CODE

onClipEvent(load){speed=10;}onClipEvent(enterFrame)
{
if(Key.isDown(Key.UP))
{
this._y-=speed;this.gotoAndStop(5);
}
if(Key.isDown(Key.DOWN)){this._y+=speed;this.gotoAndStop(6);
}
if(Key.isDown(Key.RIGHT))
{
this._x+=speed;this.gotoAndStop(7);
}
if(Key.isDown(Key.LEFT)){
this._x-=speed;this.gotoAndStop(8);
}
}


This will make him walking.




--------------------
user posted image
PMEmail Poster
Top
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

Topic Options Reply to this topicStart new topicStart Poll

 

Lo-Fi Version
   Script Execution time: 0.0247    12 queries used    GZIP Enabled
Your last action was on: A minute ago