Create a simple Flash game

Tap the power of Flash’s ActionScript capabilities to build a simple game with animated characters.

step14

14. In the main timeline, add a text field set to Dynamic. Name the field ‘score’. In your EB.as file, immediately after if(_x < -60) {, enter the following code: _root.tmpscore+=10; _root.score.text = tmpscore; Finally, we can stop the score from growing when the game ends by adding a conditional statement around the score code and the bubbles code. Add the following code around your existing statements: If (_root.playing) { // existing code is in here } Check our sample files on the disc to make sure you’ve inserted this code correctly.

step15

15. Taking it to the next level from here isn’t hard; the basics are all in place. Why not add a ‘Play Again’ button to the endGamePanel? This would need to reset ‘playing’ to true, tmpscore to 0 and hide the endGamePanel again. You could also add characters that squirt ink, and arm your octopus with a weapon. The code we used for the bubbles will work for these.

Keep up with the latest tech news, reviews and previews by subscribing to the PC World newsletter.

Sam Hampton-Smith

Digital Arts Magazine
Topics: games, flash

Comments

Enzogames

1

Good tut but,

I wish there was another way to make the animations other than Adobes convoluted programs. Maybe its me but llustrator is hell, and flash is infuriating. I figure if I keep plugging away at the flash IDE I'll get it one day. Enough griping good tutorial :)

kockningdahy

2

sanzaki

this is a nicce game

Comments are now closed.

Best Deals on PCWorld

Software and ServicesView all »
SecurityView all »
Servers & StorageView all »
Desktop PCsView all »
NotebooksView all »