Hi There!

I'm Dan Schlegel, an Associate Professor in the Computer Science Department at SUNY Oswego

Assignment 1 – Level Editor Part 1

In this assignment you will begin to build a level editor for a game built by students in previous instances of CSC241. In that game, the user played a ghost who moved around a house using a text interface, typing commands like “north” to go to the room north of their current position. Rooms can contain characters of different kinds (player, adult, child), and items which can be manipulated in certain ways (shake, possess, throw). The users goal is to scare characters out of the house by continually manipulating objects.

In this assignment you will design a simple GUI level editor for some aspects of the game. Specifically: 

  • Create a JFrame for your program. Be sure to give your JFrame a title and initial size. The frame will contain a JPanel as described below.
  • Create a JPanel on which the user will build the house. Draw a 5×5 grid, where each space represents a potential room location (we’ll assume rooms are always only one grid square in size).
  • Create a Room class which contains two String fields – name and description – and an appropriate constructor. 
  • Create a two dimensional array, the same size as the grid, to store your Rooms in.
  • When users click an unoccupied grid square, open a new JFrame which allows the user to enter the room name and description. Using the entered data, create a new Room object and store it in the appropriate place in the Room array. 
  • When a square is occupied by a Room, indicate visually that the space is occupied on the grid by printing the room name in the appropriate location. You may choose to do more advanced drawing as long as the name is still printed. When drawing each grid space, you can check to see if the array contains an element at that location to determine how to draw it.

If you would like to experiment with the game from last semester, you can download a jar file (and required sample input file). The complete project description from last semester is also available. But remember, you don’t need to build the game! 

Extra credit: 10% extra credit will be given for going above and beyond the specifications outlined above. For example, you might add functionality to delete rooms after they’ve been created, or to click a room already created and change its name/description.