Flash_and_Flex_03_2009

ActionScript Development

Create your first ActionScript game in minutes

by Damien Davidovic

This step-by-step guide will take you from a blank flash document to an alien shooter game in minutes, with any tricky parts explained in ordinary everyday language. The tool that you'll be using to make your game is Adobe Flash CS4.

screen (by default) you will see a column of icons representing various tools. Click and hold the mouse button down while over the brush icon and select the Spray Brush Tool. Get back to the Properties panel and set the scale to 50%. Change the color to pure white. Scroll down the panel and set the width to 640px and the height to 480px. Use the Spray Brush Tool briefly on the stage to create a nice starfield. We'll go one step further with the background by adding a glow at the bottom. Go to the time line panel and click on the dot below the padlock icon to lock the Stars layer. Create a new layer above the existing layer and call it SkyFlare . Create a basic rectangle of any size and left click on it to select it. Go to the

What you will learn… • How to use some of the less common drawing tools • General ActionScript syntax • How to create simple buttons and override their default behavior • How to create and use external classes • How to dynamically create and remove objects during runtime using ActionScript • How to use layers in the time line to create composite backgrounds • How to link objects created on the stage to the ActionScript code within a frame on the time line

What you should know… • Basic knowledge of Adobe Flash CS4 interface • Basic flash design concepts • How to draw basic shapes in CS4

Change the name of the existing layer in the main time line to Stars. On the left of the

Level of difficulty

W e'll start by setting up the background and the static on- screen parts of the game. First create a folder called Alien shooter on your computer that will act as the game's main folder. Create another folder within the main folder called Scripts . Open up CS4 and create a new Flash File (ActionScript 3.0) in the main folder. If the Properties panel is not already visible, view the Properties panel by going to the Windowmenu and selecting Properties. Position the Properties panel at the bottom of the screen. With the panel open, change the stage color to be entirely black. Afterwards, click on the Edit button which is adjacent to the size text. Set the dimensions to 640 width by 480 height. Set the frame rate to 30 fps and the ruler units to Pixels. When finished, close the document properties dialog.

03/2009 (5)

26

Made with FlippingBook HTML5