Back

Assignment 3 - Your Game

Guidelines

Due 11.59pm, Sunday, July 5th.

  • You are graded on the completeness, neatness, comments, and visual style of your final assignment
  • All assignments are individual
  • ZIP SKETCH FOLDER (not individual files) INTO ONE FILE
  • Submit to WebCT before the deadline

There is no late policy for this course!

If you do not complete the assignment by the deadline, you will receive 0
You "may" be excused pending discussion with your TA

Overview

In this assignment, you will create your own game from 3 custom classes and 2 subclasses. You will practice the concepts of methods, parameters, arguments, if else statements, for loops, ArrayLists, objects and inheritance. Make sure you review these concepts and plan your assignment carefully!

Programming Requirements

  • A class to describe a Character
  • A class for a Player (subclass of Character)
  • A class for a Projectile
  • 2 subclasses of Character, 1 "basic enemy" and 1 "boss enemy"
  • More info below (click down)

The Character Class

  • fields for position, velocity, acceleration, health, width, height
  • update method for movement
  • move method for movement
  • hitCharacter method has a Character parameter and returns a boolean (true if characters touch each other's bounding boxes, use width and height)
  • decreaseHealth has an int parameter
  • any other general methods for ALL characters should go in this class

The Player Class (extends Character class)

  • moves with keyboard keys (a,w,s,d) or arrows
  • DOES NOT move based on tiles, character slides around and can move in 2 directions at once
  • can fire and keep track of projectile objects (ArrayList)
  • has a method with a nested for loop to check all projectiles against all enemies (uses Projectile method hitCharacter in loop to check if a character has been hit)

The Projectile Class

  • fields for position and velocity
  • constructor with parameter for initial velocity
  • update method, no damping Projectiles keep going, removed if offscreen
  • draw method
  • hitCharacter method has Character parameter and returns a boolean (true if Projectile position is inside character bounding box)

The Basic Enemy (extends Character class)

  • does not fire but should be annoying and difficult to kill
  • player is damaged if hit by enemy
  • can take 2 - 3 hits to kill
  • when health == 0, enemy appears dead for 2s, then is removed from list
  • override of Character draw method

The Boss Enemy (extends Character class)

  • can fire and keep track of projectile objects
  • has a method that loops projectiles and calls Projectile class method hitCharacter ONLY for the player object
  • can take 10-20 hits to kill
  • when health == 0, enemy appears dead for 2s, then is removed from list
  • override of Character draw method

Design Requirements

This is your game, but you must have a coherent design that also fulfills the programming requirements.

  • Enemies should move in interesting ways, you decide if they should bounce on the walls or repeat, or maybe disappear when offscreen
  • The game should be challenging but NOT impossible
  • Backgrounds can be images
  • Make sure you have a HUD to display player health, enemies killed / score
  • Characters (and projectiles) must be drawn using shapes

Ideas

You have complete freedom to design any kind of game you want, here are some suggestions:

Tips and Tricks

  • Pay attention in the labs and lectures, check the notes and use the examples
  • Style counts! Take time to design your scene and character
  • Start now!