First time here? First time here? Newsletter Signup Newsletter
Login | Register | 651326 Members and growing! | Flash Jobs
Search tutorials
Author: Luke Knepper | Website: http://zazeran.com

Hi! This tutorial will teach you how to make a basic space invaders game a lot like this one in Flash 8. So, let's get started!

First you will need to set up your main timeline. You will want to select the size, by clicking on the button in the bottom inspector. A good size varies, for a space invaders game 600x600 would probably be pretty good. I suggest you make multiple layers (click on the new layer button in the timeline at the top), at least two named "game" and "background" and you may have even more, but this is not mandatory, it just makes the game more organized. Next, make a second and third key frame in ALL of the layers. Now you should have three frame sequences. In the top frame of each sequence, put the code "stop()" (click on the frame and press F9 to open up the code editor). In the first frame, also put this code: "var score: Number = 0" and on a newline "var life: Number = 100". What this does is make to variables, score and life, that can be accessed anywhere in the game. You can do this for as many variables as you want if your games get complicated. To access these variables through code, just put "_root.varName". (Note: In a specific symbol / object, you can make a variable just by typing the name and setting it equal to anything. However, this variable is only easily accessed by the specific object, so it is better to make a global variable in the main timeline.) The first frame will be the opening screen. You may design this however you want, putting the title and a bunch of cool effects, but you must have a button. Before you design anything make a button using the drawing tools that you want to be the start button. (Note: If you have any text make sure to select it and press Ctrl+B twice to break it apart!) Now select the whole button image and press F8. This will convert it to a symbol. As a name type "Start btn" and check the button type. now your drawing will be highlighted in blue. Select it, and press F9 and insert the following code:

on(release) {
gotoAndStop(2)
}

This means "When the button is released from a mouse press, go to Frame 2 and stop." If you test run your game, you will see that the button disappears when you click it! This is because the button is not in the second frame. Now make a game over frame in the third one. To make a text field that shows your score, choose the text field tool, and draw one. In the bottom, with the field selected, choose "Dynamic Field" and under the "Var" field put "score". Now that you have the basics set up, you will need to make the following sprites as movie clips: a tank sprite (you), a bullet sprite (your bullet), a ship sprite (the invader(s)). To make a new symbol (sprite) press Ctrl+F8. Then select "Movie Clip" and type in the sprite's name (i.e. tank, ship1...). Now that you have those done, go back to the main timeline. In the second frame (the game frame) place the bullet off the stage (drag and drop the bullet symbol from the library, the left inspector), the tank on the stage at the approximate y location you want it, and the invader off the stage. Next I will show you all the code you need to add!

» Level Basic

Added: 2006-12-13
Rating: 4.47 Votes: 45
(10 being the highest)
» Author
Luke is an active Java, PHP, and Flash programmer, website designer, and game developer. Has much programming experience.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!

Comments

  • tutorial

    Posted by sheila mae reyes on 07/08/2014 06:22pm

    it is the use of the game while having MY MODULE

    Reply
  • 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.