The tower defense game has become immensely popular in the last few years. The game involves enemies traveling along a predetermined path while the user must strategically place towers along the path to stop the enemies. Once placed, the towers automatically shoot at the enemies while the enemies’ only goal is to get past the antagonizing towers to the end of the path. My tower defense game is run completely on ActionScript with only the Win and Lose frames created in Flash. The stage is divided into 25x25 pixel blocks. The blocks act as “buttons” that let the user place towers on them when they are clicked on. The road is programmed from an array, using special direction blocks that tell the enemies which way to turn. The amount of enemies is also controlled from an array where their health and numbers can be changed. There are six files used in my project: the source file, Turret.as, Bullet.as, DirectBlock.as, EmptyBlock.as, and Enemy.as. The Turret.as file creates the turret, allows the user to place the turret, and rotates the turret. Bullet.as creates the bullet and destroys it when it touches an enemy. DirectBlock.as creates the special directional blocks, and EmptyBlock.as creates the regular “button” blocks. Enemy.as makes the enemies and determines their health, speed, and color. The source file contains the Win and Lose frames as well as the text for the level, number of enemies left, and number of lives left which are changed through ActionScript. The ActionScript in the source file contains the information of the road, levels, and other basic functions that the game requires, such as starting a new level when all the enemies have been destroyed.

Share this project:

Updates