HTML Document Structure
Player animation
the first thing you need to do is create a movie clip. Inside the movie clip draw your player1. Remember to draw every part in different layers. Once you have done that insert another layer and call it actions. in this layer you need to place an invisable button. then in the actions for frame 1 of the actions layer enter this code stop();
Player animation(cont)
Now create a key frame in frame 2 of every layer. using motion tweens create your players first attack e.g kick,punch,whatever. At the final frame of the actions layer enter this code gotoAndStop(1); Do this for three other attacks, with the same code at the end. If you want you can do two more animations one for croching and another for jumping.
Player controls
at the moment if you placed this movie clip on the main timeline and tested the movie nothing would happen. well it's time to change that. to do this create a button and insert a keyframe on the frame called hit. in this keyframe draw whatever the hell you want because no one will se it. once you have done that place it in the actions layer of your player movieclip. and enter this code
on (keyPress "
Player movement
the last part and easiest to do all you need to do is place an instance of the player movie clip on the main timeline and enter this code onClipEvent (load) { moveSpeed = 5; } onClipEvent (enterFrame) { if (Key.isDown(Key.LEFT)) { _x -= moveSpeed; } if (Key.isDown(Key.RIGHT)) { _x += moveSpeed; } } And thats it. If you want you can add a second player by duplicationg the origional movie clip flip the whole thing horrizontaly and change the buttons. the next tutorial will cover hitTest and damage metres
» Level Intermediate |
Added: 2005-01-20 Rating: 4 Votes: 15 |
» Author |
Some brit |
» Download |
Download the files used in this tutorial. |
Download (0 kb) |
» Forums |
More help? Search our boards for quick answers! |