CPSC 170 Post Lab 4
Level Editor
Due Before Class on Monday, February 8th

Sprite

For this assignment you will create a level editor for a simple platform game. A platform game is a game where the primary play mechanic is directing a character to jump between platforms. A level editor is program that allows the user to interactively layout aspects of a game. The level editor for your platform game will allow the user specify the location and size of platforms.

Details

You should begin by creating a class that represents a platform and a class that represents a collection of platforms. These classes will be used both by the game and by the level editor. The platform class will need instance variables to represent the location and size of the platform. The collection of platforms class should contain an array of platform objects. Feel free to use the Array class that we created in class to make writing this class easier. The collection of platforms class should contain methods to read and write a string representation of a collection of platforms to a text file. You can choose whatever file representation you think is appropriate.

Once you have completed and thoroughly tested the platform and collection of platforms classes you should create the level editor. You can use the drawing program that we created in class as a basis. Modify the drawing program to use the collection of platforms instead of the array of Shapes. The level editor needs a way to specify files to read and write so that they can be edited. You should add a menu bar to the level editor window with the menu items File>Open and File>Save. When the Open menu item is selected the program should display a file dialog that allows the user to select a text file. If the text file is a valid collection of platforms, it should display the platforms represented in the text file. When the Save menu item is selected the program should display a file dialog that allows the user to specify the name and location to save the current collection of platforms to.

Finally, after completing and thoroughly testing the level editor you should create a simple platform game that utilizes the platform and collection of platform classes to load a level. When the program is run it should display a file dialog so that the user can select a collection of platforms to load. If the file selected by the user is invalid the program should display a very simple level. The game should consist of a player controlled rectangle that moves left and right with the arrow keys, and jumps when the up arrow is pressed.

Submission: Tar and submit your code on the course blackboard site.