COMP 1671 , Fall 2006

Assignment 2

Due Nov 1 (Edginton) / 2 (Leutenegger), 2005

You are to write a game where you have an avatar that you want to move from a start location to an end location by pushing the avatar with your mouse. There will be N obstacles on the screen, where N will be entered by the player. N can be arbitrarily large, hence you need to use arrays for storing and accessing the obstacles. Three fourths, floor(N * 3 / 4), of these obstacles will be benign barriers and the remainder are forbidden obstacles (black-balls, poppies, democrats, republicans...). If you avatar hits a barrier it should just bounce off. If your avatar hits a forbidden obstacle the game ends, you lose. These obstacles should be placed randomly on the playing field and all obstacles should be fully contained within the field. If you make it to the end location without hitting a forbidden obstacle you win. You game should have three phases:

  1. Start Phase. Here you ask the user for two inputs: how many obstacles they want and the speed of their avatar. When they have entered both numbers and push a start button the number of obstacles the game moves to phase 2. Note, you should make sure that both numbers are entered before moving to phase 2, and if not prompt the user again to enter both.
  2. Play Phase. Here the user needs to move their avatar from start to finish without hitting a forbidden obstacle. You need to time how long it takes the player to complete the task. Once the avatar makes it to the end location, or once they hit a forbidden obstacle, the game moves to phase 3.
  3. End Phase. Here there is a message that they lost if they hit a forbidden obstacle or the time it took them to complete the task. They should also be given an option (and button) to play again, which moves them back to the start phase so they can reset input parameters.
Again, balls and rectangles are fine, but at least make sure the avatar, barriers, and forbidden obstacles each have obviously different colors or shapes. Again, the code for using a mouse to "push" the avatar in the direction you want is in c4_mouse8.fla . It is fine to use any of the code on the class web site as a starting point.

Optional Extras

There are no points for extra credit, to me that just means a bigger assignment for all, but, the following are options you could included just for fun:
  1. As game play continues the obstacles grow.
  2. As game play continues barriers switch from benign to forbidden obstacles.
  3. When you hit a barrier you bounce, but then the barrier turns into a forbidden obstacle.
  4. Add a brief narrative story to the first frame explaining the context of you goal and quest. Tie your obstacle and barrier art image choices into the story.
  5. Have the forbidden obstacles all moving slowly, with speed increasing as play continues.

What to "hand" in: