Flash dodge ball game part 3 character advanced moving


In this tutorial we will make our little game character a bit more alive, we will make his legs, and body move when he walks, just for the fun of it.


1.
If you havent done it already start by naming the character, we will be needing this alot, so I recomment you use the same name as I did if you tend to follow the tutorial serise.

I named mine joe, so when we refere to him, we will say _root.joe

2.
First of double click on joe to get into the movie clip, now in the timeline, name a new keyframe at frame 2, so we have joe in frame one, and frame 2.

We are going to animate joe in frame 2, so when we want him to walk we just jump to frame 2. (confused?, try to stay with me).

3.
Go to frame 2, select joe (all the part of him) right click and convert it to a movie clip.

double click this movie clip to get into its timeline, now we need to animate it a bit, so what i did was to make him normal in frame 1, then make a new keyframe in frame 2, and drag his left leg a bit up as shown in the image below.
Also rotate the eyes a bit to the left, and the body.

Photoshop Tutorial thumb picture


4.
Now make a new keyframe at frame 4, and rotate the eyes and body the other way, move the left foot back down and the right one up as shown below.

Photoshop Tutorial thumb picture


5.
Make a new keyframe at frame 5, move it back to normal view.

Now you can go back to the root stage in flash.

6.
What we will do now is to tell flash to go to frame 2 in the joe movie clip when we hold down one the the keys to move joe around, and go to frame 1 when no keys is pressed.

So click joe and go to the actionscript panel, there should be some code from our previous lessons.
Type in the following code at the top

onClipEvent (keyUp) {
_root.joe.gotoAndStop(1);
}

This tells flash that when a key is up (have been pressed but is now up) then the joe movie clip should go to frame one, (the one that is not animated to walk).

7.
Now go to the part where onClipEvent (enterFrame) is, and for every walk method, that looks like this, we made in lesson 2.

if (Key.isDown(Key.UP)) {
this._y -=11;
}

Add in the following

if (Key.isDown(Key.UP)) {
this._y -=11;
_root.joe.gotoAndStop(2);
}

8.
Repeat it for key.down, key.left and key.right.

Now you are done, you can download the source code here.

Part 1 Part 2 Part 3 Part 4 Part 5 Part 6 Part 7

0tutor.com rss feed