Programming Assignment 3 Boulder Blast Solution
The Project 3 specification document is complete.
To see what the game looks like in action:
On a Windows machine: Open the sample executable zip file and drag the folder named BoulderBlast in it to your desktop. In that desktop folder, double-click on the BoulderBlast application.
On a Mac: Unzip the sample executable zip file. In that zip file is a file named README.txt that tells you how to launch the program.
Use the arrow keys (or 8426 or wasd) to move or the space bar to shoot. You can hit Escape to sacrifice a life and restart the current level. You can type q to quit the game prematurely. Hitting the f key freezes the action; hitting any key after that takes one action step, except that hitting the r key resumes regular play. (This is not intended for normal game play, but is useful for testing.)
You can also download the project skeletons with the code we've written, for Windows, Mac, or Linux, and make sure you can build and run them. All they'll do is have you lose a life each time you hit Enter, but at least you can verify that the graphics library works.
The only files you will modify are Actor.h, Actor.cpp, StudentWorld.h, and StudentWorld.cpp. Indeed, those will be the only code files you'll turn in, so in implementing your solution, you must not depend on any changes you make to code files other than those four.
At some point in Project 3, you may find the Stringstreams writeup helpful.
To make testing your program easier, you might want to slow down the game. If you change the value of the constant MS_PER_FRAMES in GameController.cpp from 10 to a higher value, the game will run more slowly.
When testing your program, you may want to set up level files with easy-to-test configurations. The level files we provided are puzzles that make the game interesting, but surely you don't want have to play a while before you reach the situation you want to test!
What Do You Have to Do?
You must create a number of different classes to implement the Boulder Blast game.
Your classes must work properly with our provided classes, and you must not modify our classes or our source files in any way to get your classes to work properly (doing so will result in a score of zero on the entire project!). Here are the specific classes that you must create:
1. You must create a class called StudentWorld which is responsible for keeping
track of your game world (including the maze) and all of the actors/objects
(SnarlBots, KleptoBots, Bullets, Jewels, Goodies, Holes, Boulders, the Player’s
avatar, etc.) that are inside the maze.
2. You must create a class to represent the Player in the game.
3. You must create classes for Horizontal/Vertical SnarlBots, Regular KleptoBots,
Angry KleptoBots, Factories, Boulders, Holes, Walls, Jewels, Extra Life Goodies,
Restore Health Goodies, Ammo Goodies, Walls, and the Exit, as well as any
additional base classes (e.g., a Robot base class if you find it convenient) that help you implement the game.
You Have to Create the StudentWorld Class
Your StudentWorld class is responsible for orchestrating virtually all game play – it keeps track of the whole game world (the maze and all of its inhabitants such as SnarlBots,KleptoBots, the Player, Boulders, Walls, the Exit, Goodies, etc.). It is responsible for initializing the game world at the start of the game, asking all the actors to do something during each tick of the game, destroying an actor when it disappears (e.g., a SnarlBot dies), and destroying all of the actors in the game world when the user loses a life.
Your StudentWorld class must be derived from our GameWorld class (found in
GameWorld.h) and must implement at least these three methods (which are defined as pure virtual in our GameWorld class):
The code that you write must never call any of these three functions. Instead, our
provided game framework will call these functions for you. So you have to implement them correctly, but you won’t ever call them yourself in your code.
You'll get 1 file (3.0MB)