CPSC 170 Post Lab 4
Level Editor
Due Before Class on Tuesday, February 14th

For this assignment you will create a level editor for a simple character-control game. The game can either be a platform game where the primary play mechanic is directing a character to jump between platforms or a top-down game where the primary mechanic is to navigate around an environment. The level editor is a program that allows the user to interactively layout aspects of a game.

Details

You should begin by creating a class that represents a level of the game. A level should consist of a list of sprites that define either the platforms or obstacles in a level of the game. The level class should read the location of all of the platforms or obstacles from a text file. The format of the text file is up to you, but a simple representation would be that each line uses space separated values for the location and size of a sprite. The level class should also have a write method that writes all of the sprites in a level to a text file and a paint method that draws all of the sprites to a graphics object.

Next, create the level editor program. The program draws an initially empty level object to a window by calling the paint method of the level class. The user of the program should be able to add sprites to the level by clicking or dragging on the window. Finally, the program should have a menu bar with one menu item that when selected displays a file dialog window so the user can specify the name and location of the file to save the current level to.

Finally, create the game. The game should use the same level class that the level editor uses. The game, however, should read the file that was written by the level editor and display the same sprites. You can use the game code that we created in class as a basis for your game, but the game must have either a win or a lose condition.


Submission: Submit your code as a zip file with your name as the zip file name on the course Inquire site.

Extra

File Menu

Add a file menu to the level editor with menu items for creating a new level, saving the current level, and opening an existing level. The save and open menu items should display a file chooser dialog box.

Scroll Pane

Put the drawing panel for the level editor inside a scroll pane, so that the user can create levels for a game that scrolls.