Search tutorials
VI. advanced games
A. movement and guy actions
Okay, you have done all of the games part and stuff, now, let's take it a little further with this advanced course for games, if you have noticed in games, people can jump shoot with a gun and fun stuff like that, well in this part of the tutorial i will explain that !
So, for a game, draw the background in a layer and on the other one, draw a normal standing stick, with a gun in his hands or anything, convert it to a symbol, a MC (movie clip) and in that movieclip on the first frame put a
stop();
action to it then draw frames after where the man runs to the right, HE MUST NOT MOVE, ONLY RUN WITHOUT GOING FORWARD and add a layer to the movieclip convert the second ketframe to a movieclip (the one where he starts running) and add an action to that frame :
on (Key.Release(key.Right)) { this.gotoandplay(1); }
I think the script is correct, else e-mail me. On the last frame of the run, add a gotoandplay(2); action, so that he continues to run, then draw some more frames after where he runs left, when he jumps and lands again, when he shoots form his gun and stuff....
NOTE : if he uses his gun, the bullet must go far enough to kill someone and the script must make him go back to the first frame so the game doesn't jam and force him to shoot forvere and ever... Once you have done that, name the first frame of every action (jumps and killing) things such as jump, gunshot ( VERY IMPORTANT, THE BULLET MUST BE A MOVIECLIP CALLED BULLET WITH THE INSTANCE NAME OF "BULLET") and stuff, know go back to your movie and give these actions to the man :
onClipEvent (load) { movespeed = 3 } onClipEvent (enterFrame) { if (Key.isDown(Key.RIGHT)) { this._x += moveSpeed; this. gotoandplay("rightrun") } else if (Key.isDown(Key.LEFT)) { this._x -= moveSpeed; this. gotoandplay("leftrun") } else if (Key.isDown(Key.SPACE)) { this. gotoandplay("jump") } else if (key.isDown(Key.CTRL)) { this. gotoandplay("gunshot") } }
I hope you understood the script, you can always change the key pressing to what ever you want, one import thing : In the movieclip, if the guy jumps he must not go forward, you can add some script so that he can jump forward and backwards, but that's if you want too (i suppose you would lol *very loud laugh*)
On the next page, i will teach you how to as the man shoots to, with a hit test, kill a man and leave him dead on the floor and you can use variable for his life or another movieclips with stop actions on every frame for a life bar tha goes down if he is shot...
» Level Intermediate |
Added: 2005-02-14 Rating: 7 Votes: 40 |
» Author |
I have done a wad of tutorials, am 11, but this one is the greatest yet. |
» Download |
Download the files used in this tutorial. |
Download (0 kb) |
» Forums |
More help? Search our boards for quick answers! |