top banner

Lab 12: Game Code Fix

Assigned: April 7th, 2009

Assignment: Although you should have some assets completed this week, your complete project 3 asset library is due next week. This consists of images, audio files, video clips.....anything you will need to begin the final project development. Note: You should begin working on the basic interactive elements of your game. Break down the functionality of your project into manageable bits and begin working on them. Although no interactivity is due for the project next week...waiting till the last minute to start scripting is a VERY bad idea.

Project Example Graphic

Lab Description:

Learning and applying ActionScript to create games (even simple ones) can be a daunting and difficult process. When asked to create a game...students often state that they don't feel comfortable enough with the nuances of ActionScript to be building a complex application. This lab exercise is designed to give students exposure to ActionScripted game concepts (collision detection, scripted motion, etc...) without having to create an entire game.

The purpose of this lab is to be able to deconstruct and repair the ActionScript for two Flash games (one in AS 2.0, one in 3.0). By doing so, it is hoped you will become more experienced with the finer points of ActionScripting for games without having to create a game from scratch. As we proceed through the weeks, we will be creating simple gaming components that utlize many gaming concepts.

Note: When submitting, put all the lab files in a single folder named LastName_FirstInitial_Lab12

External Scripting and Debug Walkthough:

Using space rocks, we will walk through some of the general strategies for debugging applications, in addition to explaining how external scripting works in a simple manner.

Debugging tips:

  • trace(), use it often. No. More often than that. A lot of often.
  • comment out lines of code until you find the problem
  • Follow the logic closely ( start at the beginning, and work through each line of code to make sure its doing what it is supposed to be doing )

External Scripting:

  • A cleaner way to write code
  • Most advanced actionscript is done in this fashion
  • Is classed-based
  • Importing is essential
  • Remember to extend MovieClip for visual objects
  • Also remember to set linkage or base class in the libary/properties panels

ActionScript 2.0: Breakout

  1. Download the Breakout_broken.fla file.
  2. Rename the file Lastname_Firstname_Breakout.fla.
  3. Open the file and repair the ActionScript. You will note the comments have been removed, which should force you to figure out the code in order to make the necessary repairs. Once the game is fully repaired, it should play like the example below.
  4. Note, make SURE you have located all errors. HInt: Look closely at the ball hitting the blocks.
  5. Once finished, submit the file to the G drive for grading. Submit the .fla....NOT an .swf file.
  6. Remember: Wait until you have completed the entire lab so that you may put all the lab files in a single folder named LastName_FirstInitial_Lab12

ActionScript 3.0: PaddleBall (a.k.a. Breakout 3.0)

  1. Download the PaddleBall_broken.fla file.
  2. Download the PaddleBall.as file.
  3. Rename the .fla file Lastname_Firstname_PaddleBall.fla.
  4. Open both files and repair the ActionScript. Once again, the comments have been removed.
  5. Comment your fixes.
  6. Note, make SURE you have located all errors.
  7. Once finished, submit the files to the G drive for grading. Note: Submit the .fla and .as file....NOT an .swf file.
  8. Remember: Wait until you have completed the entire lab so that you may put all the lab files in a single folder named LastName_FirstInitial_Lab12

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

ActionScript 3.0: Space Rocks (a.k.a. Asteroids)

  1. Although we haven't yet reviewed the SpaceRocks game as we did the Breakout game...you should be familiar enough with ActionScript 3.0 to make corrections to this simple application.
  2. As with the Breakout example, download the SpaceRocks.fla and the associated SpaceRocks.as file.
  3. Deconstruct the ActionScript and make the appropriate corrections. The working game should function as the game below does.
  4. When finished, rename the .fla file Lastname_Firstname_SpaceRocks.fla (do not rename the .as file) Submit both the .fla file and the .as file to the G drive for grading.


For questions or comments concerning the course or web site contact Ronald J. Glotzbach.

College of Technology Homepage | Purdue University | Admissions | Purdue Directory

CGT 353 - Useful Resources CGT 353 - Course Grades CGT 353 - Weekly Schedule CGT 353 -  Home Page CGT 353 - Course Information Purdue University Home Page