First time here? First time here? Newsletter Signup Newsletter
Search tutorials
Author: Jack Bowyer

Okay, first of all to be able to do this you must know most of the basic actions in the action script window, and preferably the tell target action. You must also know about movie clips, buttons etc.

So, let's get started. The first thing you must do is create a movie clip and name it "Enemy". In the first 19 frames of the movie clip (It can be longer if you want) draw your enemy and make him stand there, reload his gun, eat something... whatever you want to make space inbetween when he shoots. Once you done that go to the next unused frame in the movie clip. Now over 5 or so frames make him fire his gun at you, on the final frame of this write the code in the frame actions box:

gotoAndPlay (1);

This will make it go back to frame one once he has fired. On the next unused frames you must draw him getting shot himself... the good bit! Now we must make an invisible button the exact shape of the enemy, do this by copying the shape of the enemy one frame one and pasting it into only the "hit" frame of a button symbol inventively named "button". Now go back to the first frame of "enemy" and create a new layer above the drawings. On this layer put the invisible button and make sure that it covers directly over the enemy. Add the action to this button:

on (release) { gotoAndPlay (31); }

The frame number 31 is where the enemy was shot in my one, but you may have to change this depending on where the enemy being shot starts.

Leave the enemy movie clip now and go to the main timeline. There should only be one frame here, on which you must put a "stop" action. In frame two create a "You win" screen. Add a stop action and create a restart button going back to frame one. Do the same for a you lose screen on frame three.

Now go back to frame one. Create a movie clip labeled "Health". In it's first frame you have full health- 100%, 5 green bars, a happy face- you get the idea. In this frame put a stop action. Make the next frame and make the health slightly lower- i.e 80% and do the same for the next few frames until it reaches 0 health, all with a stop ation on. (The more of theese frames you do the longer you live)On the 0 health screen dont do a stop action- instead write:

tellTarget ("_parent") { gotoAndPlay (3); }

This will make the main timeline go to the "you lose" screen.

Go back to the main timeline and name the healthbars instance name as "Health. Go into your enemy timeline and on the frame where his gun fires write the code:

tellTarget ("_parent.Health") { nextFrame (); }

This will tell the health bar to go to the next frame, lowering your health, if it reaches 0 it will make the main timeline go to the "you lose screen". Now go to the last frame of the enemy dying and write the code:

tellTarget ("_parent") { gotoAndPlay (2); }

This will make you go to the "win" screen if you shoot him.

Now for the custom cursor. Draw a crosshair and make it into a movie clip. Now paste it into the center of the first frame of your main timeline. In its actions write:

onClipEvent (enterFrame) { Mouse.hide(); } onClipEvent (load) { startDrag ("", true); }

This will hide the mouse and make the movie clip drag as if it was the cursor. The crosshair must be on a seperate layer above the enemy layer.

This is just the basics of a very simple shoot em up. In the next tutorial i will tell you how to add a lot more detail to the game. And just to make it seem even simpler to make i'll tell you that i am only 13 years old and i worked out the whole thing myself. There probably are better ways for the health bar and stuff but i'll leave that for the experts.

» Level Intermediate

Added: 2003-06-05
Rating: 6.99 Votes: 237
» Author
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!
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.