Data Structure for Side Scrolling Game

Hi,

I have a programming assignment that wants us to create a very basic console-based side scrolling game. Here I have the exact assignment just I don't leave anything out:

You get to decide what kind of side scroller game you wish to have. The idea of scrolling is that the "world" of your game is much larger than what the user can "see" at a time during game play. Thus, you would provide a "window" into the "world" during game play. As your game progresses, you move this "window" around to you can see different part of the "world" (sometimes, this is referred as "panning"). You can determine the direction of "scrolling", but your game must "scroll". You must not divide your world into grids/rooms and only just from one grid/room to another, it would not be considered a "side scroller game".
You must have three different types of objects in your game.

The Player. This is the object that the user controls. The player is to do something: kill things, find things, avoid things, etc.
Things that Move. An object of this type may move around in your game world. It is possible for such an objec to spawn other objects.
Things that Don't Move. An objects of this type cannot change its position in your game world (although it is possible for such an object to spawn other objects).
For this assignment, we will use a text-based game. You must use characters to represent the different things that are moving. Since it is character-based, you have character positions and lines. You can think of each possible character position as a pixel. You can decide how big your "screen" is by defining how many character rows and columns there are to be. Then you write that many characters per line and that many lines each "turn" of the game.
Your user should be able to pause the game, stop the game and start a new game, or just exit the game. All of this, including playing the game will require keyboard input. You won't be able to use the mouse, yet.

Statistics: You must keep track of something - players hit points, money acquired, things acquired, experience acquired, etc. This doesn't have to affect how the game gets played, at least not yet.

Some Object-Oriented Requirements

To implement this assignment, you must have at least the following 5 very different classes:
The Player Class. This is the object that the user controls. The player is to do something: kill things, find things, avoid things, etc.
A base class for Things that Move. An object of this type may move around in your game world. It is possible for such an objec to spawn other objects.
A base class for Things that Don't Move. An objects of this type cannot change its position in your game world. Although it is possible for such an object to spawn other objects.
The Game Class. This is the object that implements the rules for running your game. It is to manage the game while in progress. The Game object should have a save() method to save the game state into an external file, a load() method to load the game from an external file, a run() method to start/resume the game, etc. When the game is running, at each timestep, it queries each object to find out what action that object would like to take (including its desired new location). After it has collected all such information about all the objects, it decides (based on "game logic") on the next state of the game world. It is important to architect your code such that you separate "movement/action logic" of objects from "game logic".
The Application Class. This is the object that starts your game. Your application object should ask the user to "sign-in". The user can sign-in as an existing user or as a new user. For an existing user, a saved version of the game will be loaded. When a user is finished playing, you are to save their current data, along with any other prior player data, to a single file. The application object also keeps track of miscellaneous stuff such as high scores.
You may want to have other classes, or use inheritance. Having 3 subclasses of a single superclass does not count as 4 classes. That is one class.
If you have a nice and clean object-oriented design of your program, it should be easy to (1) add new things that move that behaves differently and add new things that don't move that behaves differently to your game and (2) add new "levels" to your game. Ideally, all this can be done without changing your Game Class! What must you use?! Polymorphism!


What would be the best way to organize all of my data? My thoughts were that I would have something of a grid that would hold one cell each, and then I could print it out. I was thinking of a queue, and each turn the very left column is removed and a column on the right is added. Any ideas? Thanks!
Topic archived. No new replies allowed.