53 line game game programming in actionscript 3. create a new document fire up flash and create a...

Post on 18-Jan-2016

216 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

53 Line GameGame Programming in ActionScript 3

Create a New Document

Fire up Flash and Create a New Document with the settings:

Width: 480, Height: 320, Background: Dark Grey, Frame rate: 24

Select the Rectangle Tool(R) and draw a square on screen about 40px tall and wide.

With the Selection Tool (V), select the square then go to

Modify>Convert to Symbol...(F8). Name the square“clsShip” make sure it’s type is MovieClip and the

registration is center.

With your “ship” square selected, go to the Properties palette (Window>Properties) and type “ship” into the

textbox for <Instance Name>

Select the Oval Tool(O) and draw a circle on screen about 10px tall and wide.

Select the circle andConvert to Symbol like above. Name the circle “clsBullet”, make it’s type

MovieClip and registration center.This time, dropdown the Advanced settings. Check the box labeled

“Export for Actionscript” and in the“Class” text area type “bullet”. Leave all the other settings default.

After you’ve created the symbol, select thebullet on the stage and delete it from the stage. In your

library window you can see the bullet still exists.

Repeat the steps from above by making another square about the same size as the first. Convert it to a symbol,

naming it “clsEnemy” and setting it’s class to “enemy”. Once you’ve completed that, delete it from the stage as well.

the only object on stage should be your original “ship” square.

Select the first frame of Layer 1 in the Timeline window and open the Actions (Window>Actions). Download the file

“Do-it-yourself ActionScript” and paste the contents into the Action window.

Now it’s time to test your file. Go to Control>Test Movie>Test. You should be able to move your “ship”

Squareup and down using the up and down Arrow keys and fire

your bullet using the Spacebar.

Get Creative!That’s it. Pretty easy, huh? Now go get creative!

top related