dcsimg
First time here? First time here? Newsletter Signup Newsletter
Search tutorials
Author: mark | Website: http://www.stickslaughter.com

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
(10 being the highest)
» 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.
» 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: Inocreato
» Title: RaiseTheBlocks
» Description: Raise all the blocks to win the game
Featured Sound Loops
Image for equalize

Audio Player

» Author: TomCat Carty
» Title: The Wood
» Description: Just a little game ending or it can maybe be looped. Recorders with music box and percussion to give the feel of well, I don't know, the woods? Free to use, just credit me. thank you
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: Davisigner
» Description: Hmm... what to say about this one? It's reminiscent of the closing notes of the opening music from the Three Stooges done in a church organ style with a closing cymbal crash. I'll give this one away gratis, but feel free to check out my free loops and potential upcoming license-mandated ones over in the respective part of Flashkit.