COMP 1671 , Fall 2008

Assignment 2

Due October 14

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/paddle. Your end location should be clearly marked, and your start location is where the game puts the avatar to start with. You can use one key to temporarily stop the ball as in the example code. There will be N obstacles on the screen, where N will be a member of the World class and can be change. N can be arbitrarily large, hence you need to use for loops for creating the objects inside your world constructor. Three fourths, floor(N * 3 / 4), of these obstacles will be benign barriers and the remainder are forbidden obstacles (black-balls, poppies, democrats, republicans...). The forbiddeen barriers should move in some sort of patrolling behavior that you think is appropriate for your gameplay. A movement of "non-movement" is not accetable. 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 must include a timer and time how long it takes the player to make it to the finish. To do this you will need to modify the Timer class code to count up from zero instead of down from a starting point. When the player makes it to the finish a win screen should appear and the timer should be stopped and remain on the screen showing the amount of time needed to win. If the player hits a forbidden object play should stop and a lose screen should appear. Finally, after some number of time units have passed, the forbiddeen barriers switch from patrolling behavior to chasing down the player's avatar using the "heat seeking" code in the Pollinator example. For images, balls and rectangles are fine, but at least make sure the avatar, barriers, and forbidden obstacles each have obviously different colors or shapes. You may use my Paddle and Ball . example as a starting point if you wish.

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: