In this assignment you will begin to construct your game following the description that you handed in for the last assignment. You will do this by creating at least 2 new classes that implement two of the interfaces I have provided and modifying one class that I provided you so that it uses those new classes. Exactly what type of classes you create will depend upon the design of your particular game. What you will be constructing now is the beginning of the "static" background that the player plays on. To do this you will write a class that implements the Screen interface and at least one class that implements the Block interface to populate your screens with. Once you have done this, you will edit the appropriate methods in the GameSetup class so that they use these new classes.
Design
The design for this assignment will include UML class diagrams for the classes that you will write. It should also include text descriptions of those classes, their methods, and what they do in the game.
Again I recommend that this be submitted by putting the files generated in Together in a new directory that will be visible on the web and send me a link.
Code
This assignment will have you writing and editing a fair bit of code. There are three basic parts to this. First you will write an implementation of the Screen interface. You can call it whatever you want. Something that reflects you or your game followed by Screen would be appropriate. For example, if you were writing a version of Pac-Man you might call it PacManScreen. There are a number of different methods that you have to implement for Screen. Each is described in the source for the Screen interface I have given you. The class will require a two dimensional array of Blocks and some form of list of GameEntities. You can simplify this second requirement for now so that it only needs to be able to handle a single entitiy. You will write a full list in a later assignment. Unfortunately, doing so will "break" the screens that you create now with the editor so don't spend too much time making elaborate maps at this point (you can come to talk to me about this if that is something you feel strongly about).
In order for your Screen class to be useful you also have to create some Block classes to populate it with. Here again I recommend giving them names that reflect both the game and their prupose (i.e. PacManWall). The Block interface has documentation describing the purpose of each of the methods in it. Some of them you will leave blank or simply have them return null at this point because you can't complete them yet. The documentation gives you hints as to when this is the case. I'm providing you with one sample Block that you can model your after. The Block classes are probably the simplest classes you will write because they don't really do much. The only part of them that is in any way difficult is producing an image for them to draw. We will be talking about that is significant detail later in the semester. For now you can build off of the example that I have given you.
After you have a Screen class and a few Block classes, you will need to edit the constructor of the GameSetup class so that it uses what you have written. There are comments in the code pointing you to what types of changes you should make. Early on you should probably comment out the loading code that is present right now. Don't delete it because you will want to have very similar code in your final version. However, for debugging you will want code that directly instantiates a screen and fills it with appropreate blocks for your testing. You might want to keep that code around for testing in assignment #3 as well.
Once your screen and block classes are done and tested, you can use the ScreenEditor that I have written for you to easily build a few screens. I don't recommend that you spend much time on that at this point in the semester because odds are high that you will make changes in the next few weeks that will invalidate any of the files you save now. However, you should play with it a bit just to make sure that you are properly following the interface and that your screen class works with it. For help on how the editor works click the link below.
Help with the screen editor program.
JAR file for the screen editor. To run the ScreenEditor use the command line and run "java -cp Editor.jar:. ScreenEditor MyScreen.class SavedFile.bin", where MyScreen.class is the compiled file for you class so it needs to have the name of your screen class. In windows the : is replaced by a ;. The SavedFile.bin is the name of the file you want it to be saved in. Also, if Editor.jar is not in the same directory you are running this in you will need to specify the path.
Source for GameSetup and BasicBlock. GameSetup you should probably edit, though you are allowed to subclass it. BasicBlock is provided just for your reference. You can take code from it. This is especially for the graphics code in it because we haven't talked about how to write that yet. I've also posted the code for a different constructor that could be used. This one loads in a screen from file so that you can use it with the ScreenEditor.