First time here? First time here? Newsletter Signup Newsletter
Login | Register | 651326 Members and growing!
Search tutorials
Author: monkey boy

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 "") { gotoAndPlay("Jump"); } on (keyPress "") { gotoAndPlay("Crouch"); } on (keyPress "6") { gotoAndPlay("Right kick"); } on (keyPress "2") { gotoAndPlay("Left kick"); } on (keyPress "4") { gotoAndPlay("Left punch"); } note: you may have to change this code a bit to get it to work depending on the length of each attack. You may have also noticed that there isn't any code for a Right punch. now all that needs to be done is movement.

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
(10 being the highest)
» Author
Some brit
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!

Comments

  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: work2survive
» Title: Girl Walking 1kb
» Description: Walking girl, animation just takes 1kb, using high heels shoes, and fashion model attitude.
Featured Sound Loops
Image for equalize

Audio Player

» Author: BoxCat
» Title: CPU Talk
» Description: From the cyberpunk RPG, "Nameless: the Hackers" Completely Free to use! Keywords: edm hip hop rap electronic mysterious mission hacking chase exciting spy ios ambient chilling love happy sad angry suspense
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: nathan
» Description:

A recorded sound of the Dimensional Fork Gate.