top banner

Lab 14: Game Build 2

Assigned: April 21st, 2009

Due: April 28th, 2009

Assignment: Your final project is due next week. This is the final lab exercise of the semester and is due at the end of lab. Next week will consist of a working lab to allow you to finish your final project.

Project Example Graphic

Lab Agenda:

  1. Submit external assignment from last week to G drive.
  2. Complete and submit lab exercise
  3. Final Project progress check

Exercise Description:

Setup:

Download the lab files. You are provided with all the files correctly setup as needed. Take some time to look at lab14.fla to see how it is setup ( the linkage on the items in the library, the FPS, and the document class ).

Open up gameMain.as to fill in the new code ( defined within "//new" and "// /new" comments within the finished code ).

The game class:

You will be adding new variables for enemies and bullets, and updating those respectively. In addition, you will add scrolling to make this a true sidescroller

Enemies:

The enemies code will be created in a seperate folder. You will have to create a file badMan.as in the folder "/src/enemies" for the code to work. In addition, the package will have to be "package src.enemies" to compile correctly. This will help you clean your code up immensely in future actionscripting.

The enemy has simple ai defined by a switch statement, and some chase code that works by checking the distance between enemy and player.

Bullets:

Bullets fly straight in this example, but gravity can be applied to it rather simply. Care must be taken not to allow too many bullets on the stage. While flash can handle quite a bit in ActionScript 3.0, each bullet is checking if it is hitting each enemy; with a number of both on the stage, it can get computationally itensive quickly.

Final assignment:

With the enemies, bullets, and scrolling working, do two things:

  • Make the enemies and player face the direction they are moving in
  • Make the bullets fly in the direction the player is face
Group work is allowed for this final assignment.

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