How to Create a Tower Defense Game in AS3

Tower defense games -- strategy war games that utilize a tower equipped with a virtual fire weapon -- can be built quickly with Flash ActionScript 3 (AS3, the Flash Programming Language). This is because there is a variety of freely available AS3 code on the Web with which to build a tower defense game. Starting with this code you can quickly build the foundation for your tower defense game and then modify it to create your own completely customized games.

Things You'll Need

  • Adobe Flash Professional (CS3, CS4 or CS5 versions)
Show More

Instructions

    • 1

      Download or copy-and-paste the AS3 code used to build the foundation for the tower defense game at one of the websites offering it, such as the Flash Game Tutorials site.

    • 2

      Locate the graphics and movie clips used for the game icons, background scenes and scoreboards used in the code.

    • 3

      Make a table (in your word processor, spreadsheet or on paper) that has four columns and 15 rows. Label the first column "Movieclip/graphic class," label the second column "Description," label the third column "Location" and the last column "Vector-coded graphic."

    • 4

      List in the first column, "Movieclip/graphic class," the class names of all the movieclips and graphics used in the tower defense game code you downloaded. In the second column, "Description," enter for each class listed a description of the movieclip or graphic relating to its appearance and game functionality. In the third column, "Location," list the file location or library location that the movieclip or graphic has been stored in (or is accessed from). Use the file path location relative to where you downloaded the main FLA file used in the game if the class file is stored in an AS3 (.as) file. Use the library name and relative library path location within the Flash library if the file is stored in the main library of the main FLA file. Use the component name and relative component location if the class has been stored as a component.

    • 5

      Examine the code and functionality of all classes within the AS3 code. Check to see if the functionality of the code actually includes the code to draw the graphic of the game piece (a dynamically vector-coded graphic). If it does, in the fourth column ("Vector-coded graphic") enter "Yes" to indicate that the code draws the graphic and that the code will have to be changed to dynamically draw a replacement game-piece icon.

    • 6

      Replace any graphics that are .gif or .jpeg files based with your own GIF or JPEG graphics to change the characters used in the game. Name these files the same name as that used in the code or change the "file name" reference that is specified in the code arguments of the AS3 "URLRequest" method of the "Loader class" to import the graphics file. If you change the name of the graphics files you want to use to those used in a downloaded game, make a backup of the original graphic files in a different directory. If you use different names, examine all of the code files of the downloaded tower defense game to ensure that you change all file references to the new names that you use.

    • 7

      Replace any library symbols used with your own library symbols if the library symbols are strictly graphic symbols and contain no underlying AS3 code.

Learnify Hub © www.0685.com All Rights Reserved