Computer Science 1xx Assignment #N
DUE DATE: mmddyyyy
(This is a list of the major topics that you, as students, will learn in this assignment:)
Grading Rubric: This document is available for you use - you should use it to to help guide your work. The rubric is a document which explains how your work will be evaluated, and is located here.
In this assignment, you are going to implement a new class, in order to add a feature to a somewhat simple text game.
The overall objective of this
assignment is for you to create a new class, within an existing, non-trivial
The overall objective of the game
is to allow the player to throw small things at floating bubbles, and thus break
The person who's throwing things will be represented by a point at the origin (0,0). The person initially can only throw small rocks. Each rock that's thrown will be represented by a circle that has a radius of 1.
An outline, in pseudocode, of the game is as follows:
The game starts out by creating a BurstABubble object (described briefly, below), which in turn creates 4 Bubble objects. Each Bubble has an (X,Y) location, and a radius between 4 and 10. In addition to your above task, you should also modify the program so that it chooses the radii and location randomly. Each bubble should be at least 10 units away from the player on each of the X and Y axes in other words, far enough away that there's a chance the player might miss them (e.g., they don't overlap the origin, etc). Two bubbles should be pretty close (under 30 units' distance), and two should be farther away (50-70 units' distance). The bubbles never move. The game will then enters the main loop.
The game mostly consists of a main loop (in the PlayRound method), whose underlying purpose is to move everything that the user has thrown (according to the speed each thing is traveling at), then print out the state of the game, then to ask the user if they want to throw another thing. Keep in mind that most of this logic has been implemented for you Im including this description here to help you figure out what you'll need to do.
First , the game will go through the array of things that have been thrown, and moves each thing (by calling the DoUpdate method). Each Rock is moved based on the X, Y speed of the Rock. After moving each thing, the program simulates the effect of gravity on each Rock by adjusting the vertical speed of the thing (gravity should pull the rock downward at a rate of 2 units of speed per update). Fireworks aren't affected by gravity they change their X & Y position based on their X & Y speed each round, and nothing else.
As the program moves each thing, it checks to see if the thing overlaps one of the Bubbles. If the thing does, then a message will be printed to the screen telling the user that the Bubble has been burst. If a thing hits the ground (it's vertical height becomes zero), then it is removed from play (it doesn't bounce, etc). Each thing disappears once it's clear that the rock/Firework/etc can't possibly interact with any bubbles (i.e., once the rock has gone past the bubbles, or hit the ground)
Having done that, the game will then print out the state of each object in the game every single Rock, Firework, and Bubble. AGAIN, THERE IS NO GRAPHICAL COMPONENT FOR THIS GAME. Simply calling the Print method on each object is fine. The objective here is that since there's no graphical display, the user needs some way of knowing where everything is. The game ends once the player has thrown all of his/her rocks, and all of the thrown rocks have been removed from play (i.e., all the rocks have been thrown, and either hit the ground, or sailed past all the bubbles).
Having done all that, the user is asked if they want to throw a rock, shoot a firework, just wait for a round (and do nothing), or quit the game. If the user chooses to throw a rock, they get to choose the speed in the horizontal (X-axis) direction, and in the vertical (y-axis) direction. The game then creates a new Rock object, which consists of the speed components (X,Y), starts off with the location being at the origin (0,0), and a Circle that's of radius 1. The player isn't allowed to throw rocks at a horizontal or vertical speed of greater than 10 units per round. If the player elects to shoot a firework, they also get to choose their initial horizontal & vertical speed, but are limited to a maximum of speed of 20 in either direction, and a minimum speed of 10 in each direction (since they're not really throwing the fireworks, as aiming it). They also have to select how many round (iterations through the main loop) will pass until the firework explodes.
The game limits the player to 3 rocks, and 3 fireworks. If the player runs out of things to throw before breaking all the bubbles, then the player loses. If the player bursts all the bubbles, the player wins.
You are provided with a starter project for Visual Studio 2005. You NEED to use the starter project for this assignment. Also, the .ZIP of the starter project contains a .EXE named Sample_Solution.exe, which has the Fireworks implemented (although the bubbles locations' aren't randomized), in case you want to play around with how the game 'should' work.
You are not allowed to work in groups for this assignment. You should start, finish, and do all the work on your own. If you have questions, please contact the instructor.
Additionally, you should aggressively comment your code, paying particular attention to areas that are difficult to understand. If you found something to be tricky when you wrote it, make sure to comment it so that the next person (the instructor, who's grading you) understands what your code is doing. It is not necessary to comment every single line.
The purpose of this requirement is to both help you understand, and have you demonstrate, a thorough understanding of exactly how your program works.
Every file that you turn in should have:
top of each file that you normally edit
, you should put your name (first and
last), the name of this class (BIT 142), and the year and quarter, and the
assignment number, including the revision number, which starts at 0 (A4.0).
If youre handing this in again for a regrade, make sure to increase the minor
version number by one (from A4.0, to A4.1").
You normally edit the C# source code files (.CS files), and any Word documents that you're handing in (if any).
You do not normally edit the .SLN or .CSPROJ files, and so you should not try to put this identifying information in those files.
In general, you should make sure to do the following before handing in your project:
· All variables used should have meaningful names.
· The code should be formatted consistently, and in an easy to read format.
What to turn in:
· A single electronic folder (a directory). This folder should contain:
o The source code for the classes. For this assignment, each class should go into a separate .CS file.
o The project files stuff ending in .SLN and .VCPROJ, so I can build your project more easily.
You have to name the folder
with your last name, then first name, then the assignment number (both the major
version 4, and the minor (revision) number 0). Example: "Panitz, Mike,
· You should not include the bin or obj subdirectories, or anything from it. I will dock you a couple points if you do. Also, you don't need to include your .NCB file, or the .SUO file, if it's present.
How to electronically submit your homework:
There's a link on the homework page to the document that guides you through handing in your work, using the SourceGear Vault program.