/* Generated by Together */ import java.io.*; import java.util.Vector; import java.awt.Dimension; import java.awt.image.ImageObserver; /* * This class provides methods for the main frame to get the components of the * game. When a MainFrame is created, it is passed one of these. Basically, * by using different GameSetup instances, the game can take on many different * forms with the same "standard" mechanism around it. * * Students will be given this class and the various interfaces in code format. * My implmentations of all the other classes will only be distributed in compiled, * .jar format. Over the course of the semester, the students will modify the * methods of this class and write their own implementations of the basic * interfaces to provide the behavior of the game. */ public class GameSetup { /** * The constructor for GameSetup is where you load in files and set up * variables that will be used for the rest of the game. */ public GameSetup() { // Load in the map. firstScreen=new BasicScreen(); // Setup basic variables. localPlayer=new BasicPlayer(new Location(firstScreen,10,10)); firstScreen.addEntity(localPlayer); priorityQueue=new ListBasedPriorityQueue(); // Set up the original queue. priorityQueue.add(localPlayer); } /** * Returns the instance of your Player subclass that should be used in this game. */ public Player getLocalPlayer() { return localPlayer; } /** * Return the priority queue that you are using for the game. You will write * two of these during the semester. */ public static PriorityQueue getPriorityQueue() { return priorityQueue; } /** * Tells the display class is this game has a scrolling background. I have * not done that much testing on the scrolling backgrounds. They should work, * but there are no promises. Debugging for you will probably be easier if * you can see the whole screen anyway. */ public boolean getScrolling() { return false; } /** * This method tells the display class if the images in the game should be * scaled. If you turn this off, you can get better performance, but you * won't be able to use different window sizes. You will also have to make * sure that all your blocks use the same image size and alter the method * below this to return the size of the image that should be expected for * a single block. * @return Whether images should be scaled for this game. */ public boolean getScaling() { return true; } private Player localPlayer=null; private static PriorityQueue priorityQueue=null; private Screen firstScreen; }