Assignment 3 – A Game of Shoot ’em upSample Page
Total Points: 34
(accounting for 10% of your final grade)
Assignment Summary
In this assignment, you will create your own game from 2 custom classes and 3 subclasses. You
will practice the concepts of methods, parameters, arguments, if else statements, for loops,
ArrayLists, PVector, object, inheritance and polymorphism.
The basic game must have this rough form:
– The human user controls a Player character (aka avatar) using the keys on the keyboard
– There are two types of “target/enemy” objects onscreen. The player’s objective is to fire some kind
of projectile at the targets/enemies. The types of targets differ in how many times the player needs
to hit them with the projectile before they are removed from the game.
Learning objectives
By the end of this assignment, you will have earned the following skills:
a) Create a subclass that extends a general class, so that you can create new functionality by
building on existing functionality you have already written
b) Use method overriding in your subclass to allow the subclass to implement some methods
differently than its parent
c) Detect collisions between different objects in your application
d) Enable users to control the onscreen objects using the keyboard
Also with this assignment, you have the opportunity to:
a) Explore different kinds of game mechanics using a simple game base
b) Begin developing your programmer-intuitions about how to efficiently design and organize the
coding logic of your applications to facilitate extension and iterative development
Assignment (30 points)
Because the overall purpose of this assignment is to start you the process of using OOP concepts and
techniques to design and implement your program, we’ve imposed a lot of requirements on how you need
to create the game. I have described each of these requirements in the table below. Be sure to read
them very carefully and use them to design and implement your various classes and methods!
Application Requirements: 4 points
• Visual collision between enemies and player (and the player projectile) must be done accurately.
-1 If a player projectile damages the enemy without reaching it visually, or does not damage after
reaching it. The same with the player when hit the enemy.
• Visual collision between the boss and player (and their projectile) must be done accurately.
-1 If player or boss projectiles damages their target without reaching it visually, or does not
damage after reaching it. The same with the player when hit the boss.
• When enemies or boss hit the player, player must lose one health for each collision.
-1 If enemies or boss reduce the player’s health continually as long as they are in contact with the
player.
• Each of the Player, Basic Enemy, Boss Enemy, and Projectiles objects must be displayed on the
screen to get credit
-1 application requirement point + minus half of the coding requirement points (see the table
below) if any of the objects above is not displayed
Coding Requirements: 20 points
A Character superclass Requirement points: 3 |
A Player subclass Requirement points: 5 |
A “Basic Enemy” subclass Requirement points: 3 |
A “Boss Enemy” subclass Requirement points: 4 |
A Projectile class Requirement points: 3 |
Your Main Sketch Requirement points: 2 |
-at least five fields for: • position (PVector) • velocity (PVector) • health • width • height -.25 for any missing field. -a moveCharacter method that moves the Character, using its velocity and position fields -.5 if you don’t have this method in Character or if you don’t use the Character fields. -an accelerate method that changes the Character’s velocity using an accelerator (PVector) -.5 if you don’t have this method in Character or if you don’t change the Character’s velocity using an accelerator (PVector) -a “dummy” drawCharacter method that just draws a placeholder shape, which will be overridden by subclasses -.5 is drawCharacter method missing from Character -a hitCharacter method that detects when two Characters have collided: • has a single parameter of type Character • returns a boolean indicating whether or not the two Characters collided. -.25 parameter has wrong type -.25 method doesn’t return a boolean -.5 method doesn’t work when the parameter Character has collided with this Character. -a decreaseHealth method that decreases the health of the Character • has a single parameter of type int, representing the |
–extends the Character class -1 Player isn’t a subclass of Character or redefines fields of superclass -human user can move the Character using four keys (either WASD or the arrow keys) -.75 Player doesn’t move by keypress -the player character can move freely through the screen, horizontally, vertically, or diagonally -.5 Player only moves in one drection at a time – can fire and keep track of projectile objects • Player uses a typed ArrayList to store its projectile objects. -.5 ArrayList to track projectiles doesn’t exist OR is defined outside the Player class -player class has a method, checkProjectiles, which iterates through each projectile object in its projectile list and checks against each enemy to see if it hits the enemy. If the projectile hit the enemy, the player class damages the enemy. In addition, the projectiles should check whether they hit the boss and damage the boss if so • use a nested for- |
–extends the Character class -1 Enemy isn’t a subclass of Character or redefines fields of superclass -must NOT FIRE projectiles –.5 enemy fires projectiles -player takes damage if they collide with the basic enemy -.5 any logic error that prevents this from occurring. -player needs to fire between 2-3 projectiles at the basic enemy and hit it before it “dies” (has 0 health) -.5 basic enemies die after one hit -when basic enemy health is 0, it appears dead/captured/different in some way for 1 second before it is removed from the game. -.5 dies instantly or doesn’t change appearance during pre-death period -basic enemy overrides Character update method so that it checks whether it collides with the player and damages the player if so. -.5 collisions with player checked anywhere other than in enemy’s update method or not at all -basic enemy overrides Character draw method. -.5 no overridden draw method * Total deduction for Basic Enemy class Requirements caps at 3 pts even if the add up goes over it |
–extends the Basic Enemy class -1 Boss isn’t a subclass of Basic Enemy class or redefines fields of superclass (those of either Basic Enemy or Character) -can fire and keeps track of projectile objects in a typed ArrayList • The Boss projectiles are either the same class as the Player’s Projectiles OR they are a subclass of Projectile that extends the functionality in some way. -.5 ArrayList to track projectiles doesn’t exist OR is defined outside the Boss Enemy class -.5 Boss projectiles look identical to Player’s ones -Boss has a method, checkProjectiles, which through each projectile object in its projectile list and uses the Projectile’s hit method to check whether it hits the PLAYER only and damage the player if so -.5 checks collisions against anything other than Player (i.e. with Basic Enemies) -0.5 Player isn’t damaged by the Boss bullets -player takes damage if they collide with the boss enemy -.5 any logic error that prevents this from occurring. -player needs to fire 6 to 8 projectiles at the boss enemy and hit it before basic enemy “dies” (has 0 health) -.5 dies after fewer than 6- 8 hits -when boss enemy health is 0, it appears dead/captured/different in some way for 3 seconds before it is removed from |
-Projectile is a standalone class. -1 Projectile is a subclass of Character -has fields for position and velocity -has a constructor with a parameter that represents initial velocity -.25 for any missing field. –a move method that moves the projectile -.5 method missing -a checkWalls method that checks if the projectile has gone out of the screen. -.5 method missing -an update method that calls the move, draw and checkWalls methods. -projectiles that go out of the screen should be removed from the list that holds it. -.5 update method missing or fails to invoke move, checkWalls and draw methods -.5 projectiles aren’t removed from list when they go offscreen -a method that draws the projectile -.5 missing method -a hit method that checks if this projectile hit a Character • has a single parameter, typed Character • returns a boolean indicating whether or not |
-keep track of basic enemies in a typed ArrayList. -.5 basic enemies not in a typed ArrayList -keep track of player’s score (related somehow to the number of enemies killed) in a global int variable or define a class for score -display the score somewhere on the screen -.5 score isn’t tracked at all -.5 score is tracked but doesn’t appear on screen -there is only one boss. • Store the boss in the same ArrayList for the basic enemies along the line of inclusion polymorphism. -1 boss stored in a single variable or inside its own ArrayList instead of the same ArrayList for basic enemies |
damage. -.5 method missing from Character class. -.25 missing parameter -.25 body of method doesn’t use parameter to decrement health field -a checkWalls method that checks whether the character has gone off the screen boundaries and compensates in some way (i.e., reappear on opposite side, bounce/reverse velocity) -.5 method missing from Character class. -.25 any error in collision logic, including use of wrong type of collision (bounding box vs radial) or failure to factor Character’s dimensions into the calculation of the bounds check -has an update method that calls the move, and check walls -.5 method missing from Character class. -.25 update method body doesn’t invoke move, checkWalls * Total deduction for Character class Requirements caps at 3 pts even if the add-up goes over it |
loop to check the projectiles against eh basic enemies • call the projectile’s hit method to check whether the projectile hit the enemy. -.75 Player can’t shoot projectiles at all or projectiles don’t damage the enemies when they hit -.5 No nested for loop -.25 check against the boss is also inside of the nested for loop (instead of just happening once for each projectile) -player overrides Character update method so that it calls checkProjectiles. -.25 logic to check the projectiles isn’t inside a method called checkProjectiles -.25 method called from anywhere other than an overriden update -player overrides Character’s drawCharacter method. -.5 no overriden draw method * Total deduction for Player class Requirements caps at 5 pts even if the add-up goes over it |
the game. -.5 dies instantly or doesn’t change appearance during pre death period -boss enemy overrides Basic Enemy’s update method so that it: • checks whether it collides with the player and damages the player if so. • calls the checkProjectiles method -.5 code that checks for collision with Player or checks projectiles against Player is defined ANYWHERE OTHER THAN Boss’ overridden update method -boss enemy overrides Character draw method. -.5 no overriden draw method * Total deduction for Boss Enemy class Requirements caps at 4 pts even if the add-up goes over it |
the projectile hit a Character -.5 method isn’t defined in Projectile class -.5 method parameter has any type other than Character -A projectle that hits a Character are removed from the list that holds it. -.5 any logic error that prevents this from occurring * Total deduction for Projectile class Requirements caps at 3 pts even if the add-up goes over it |
ECO: 6 points: for the effort, creativity and originality you put into the game. Here are
some ways to earn ECO points (Please note that total ECO points cap at 6 even if the add-up
goes over it). Please note:
• Assignment 3 leaves more room for creativity than our previous two assignments. If you have an
idea for how to get ECO points that is NOT on this list, please email your TA or instuctor to
check whether it counts
• Everyone is suggested to put a text file (called README) into you assignment file submission
that describes the parts of your code that you think should count for ECO points.
Character animations:
-Use push/pop and translate to allow for different parts of your characters to move independently.
+.5 simple animation involving one part, similar between different characters (Player, Enemy, Boss).
+1 more complex animations involving multiple parts. Bosses, enemies and Players animated in distinct
ways
+1.5 animations tied somehow to the states of the characters. E.g. when enemies start to lose health they
begin to walk as though they are slipping or stumbling.
Gameplay mechanics:
-Implement some “difficulty scaling”:
+.5 enemies move faster as player score increases
+1 enemies develop an ability to use a “shield” (randomly sometimes the enemies can put up a wall to
block a bullet, or dodge a bullet; the probability of this occurring increases with player’s score)
+1.5 program your basic enemies so that they attack in “waves”, which each successive wave involving
enemies that move faster, more intelligently (i.e., move intelligently toward the direction of the player)
+.5 make the boss appear only after the basic enemies are dead
+1 boss entry follows a short “cutscene” during which the boss “makes his entrance” or even “says
something” using a textbox
Narrative and Flavour:
-Use screens that have text or text boxes, speech bubbles, etc., to provide a narrative for the game
+.5 start and end screens have some basic “flavour text”
+1 you include “text boxes” that pop up and show dialogue of the enemies, boss, players, or incidental
information (like in the old Star Fox games)
+1 you actually make some kind of “cut scene” (or cut slideshow) involving a few screens, which have
not just text but also images to describe what is happening
Gameplay depth and complexity:
-Implement some powerups or other pickup items
+.5 basic “health boost” item that increases the player health when the player picks it up
+1 implemented different weapons; when the player picks up a new “weapon” their bullets take on
special abilities (e.g. bullet can track an enemy, bullets temporarily do more damage)
+1.5 different weapon has a more complicated status modifier effect. E,g, player can pick up a fire gun
that “burns” the enemy, slowly sapping away at its health for a period of time; player picks up a “freeze
gun” that temporarily stuns and prevents the enemy from moving
+1 implement special defense items (e.g., invincibility, shield, speed boost)
Achievements
-Track some random player behavior and inform them with an “achievement” when they accomplish a
certain random objective. Some examples:
• kill X enemies in X amount of time (+1-1.5)*
• avoid getting hit for X seconds (+1-1.5)
• kill X enemies at once (+1-1.5)
* grading variation depends on how you inform the player of the achievement- do you just a flash a
message on the screen? (less impressive) or do you have a rewarding image and then display the player’s
achievements somewhere on the HUD? (more impressive).
Many other things are possible!!! Examine some old SNES, NES, SEGA, or modern small-scale
indie games (http://gamejolt.com/) for ideas. Here are some examples that you can draw for
inspirations:
• Asteroids
• Scrolling Shooter
• Top Down Shooter
Submission and Grading
Assignment Code (30 pts):
• It is an individual assignment.
• Zip the project folder (MUST be the folder NOT individual files) into a single Zip File.
Rename the zip file using the following naming standard:
LabNumber_FirstName_LastName_AssignmentNumber_StudentNumber.zip , e.g.
E101_John_Smith_Assignment3_1234567, and then upload it to the Canvas before or by
the deadline.
• Before the deadline, you are allowed to resubmit if you feel necessary, and the last one
submitted will be graded.
(Please note, -0.25 will be deducted for each violation of the rules specified above)
• No late submission will be accepted. If you do not complete the assignment by the deadline,
you will receive 0. You will also receive 0 for missing sketch or folder.
• For a legitimate reason a late submission might be allowed pending discussion with your TA
before the deadline. You may be required to provide supporting documents.
You are graded on completeness for the basic requirements and visual style evaluated by Effort,
Creativity, Originality (ECO) of your assignment
Online Test for the Assignment (4 pts):
To demonstrate that you learned the relevant concepts, you need to answer an online test regarding
the work you’ve done.
The test will be posted in Canvas and available immediately after the Assignment DUE TIME.
You must get it done within 2 days after the DUE DATE, and you have 30 minutes to finish it once
started. Please note once the online test is closed by the end of its schedule, there is no way to reopen it for any individual and therefore NO Make-Up is possible. So it is your responsibility to
make sure you do it in time to get full credit for your assignment.