
So you would like to know how to make a game? Well, I can teach you but not in one sitting, that’s why this is part 1 of the Spaceship Tutorial.
Once you’re finished with these tutorials you’re gonna have a full Flash game (ActionScript 2.0, I’m old fashioned
), but there’s a lot to be learned so let’s get started!
Step 1. Preparation
First create a new document (CTRL + N, select Flash Document) and change the frame rate to 45 in the properties pane, this will make sure the game will run nice and smooth.
Step 2. Drawing the ship
First things first we’re going to need the spaceship to move, draw one yourself or use mine (download below).

Once you’ve drawn your spaceship, select it and hit F8. In the new window tick MovieClip and press OK. Now your ship is a MovieClip, what that means is that it’s going to be interactive or animated.

Select the MovieClip and hit F9, that’s going to open the code screen where you can punch in some code that the spaceship is gonna execute.
Step 3. Making it move
Enter this code in the code window:
1 2 3 4 5 6 7 | onClipEvent(enterFrame){ if(Key.isDown(Key.LEFT)){ _x -= 6; }else if(Key.isDown(Key.RIGHT)){ _x += 6; } } |
Now the explanation of the code:
onClipEvent(enterFrame){
This line tells the code that the following actions have to constantly be executed.
if(Key.isDown(Key.LEFT)){
Now it checks if the left arrow key is held down, if so, then it executes the following line:
_x -= 6;
This tells the spaceship to subtract 6 pixels from it’s X axis.
}else if(Key.isDown(Key.RIGHT)){
This makes sure the left arrow key isn’t held and checks if the right arrow key is held, if so, it executes the next line:
_x += 6;
This adds 6 pixels to the X axis of the spaceship. And last but not least we close all open tags:
} }
Step 4. Testing and finishing
Press CTRL + ENTER to test your game, now you should be able to move the spaceship left and right with the corrosponding keys!
If you had problems feel free to ask questions below, if you want a sample download the source file here:
Next up we’re gonna make the spaceship shoot some lasers! Click here to read part 2!

Home
Games
Portfolio
Goodies
Contact






Very Cool
!
Kenney is the best