/* Generated by Together */ import java.io.*; import java.util.Vector; import java.awt.Dimension; import java.awt.image.ImageObserver; import javax.swing.*; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.util.Iterator; /** * 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. * * DO NOT modify the signatures of the methods provided here. You can add * other methods to this class, but don't change the ones that are present * or your code is likely to stop working inside the framework. */ public class GameSetup { /** * This method should be called in your main before you create your MainFrame. * It should initialize all of your variables that are related to the general * state of the game. */ public static void constructVariables() { // Set this to whatever works well for your game. Location.setPartialsInWhole(5); Vector vect; /* // Load in the map. // You can uncomment this code when you want to have your game load a map // that you made with the ScreenEditor. try { vect=ScreenEditor.readScreenVector("BasicMap.bin"); firstScreen=(Screen)vect.get(0); } catch(IOException e) { firstScreen=new BasicScreen(); } catch(ClassNotFoundException e) { firstScreen=new BasicScreen(); } */ // This builds a screen using the default constructor. I put it in the // vector so that it works with the code below that was written for the // loading. vect=new Vector(); firstScreen=new BasicScreen(); vect.add(firstScreen); // Setup basic variables. localPlayer=new BasicPlayer(new Location(firstScreen,10,10)); firstScreen.addEntity(localPlayer); // Set up the original queue and add all entities. priorityQueue=new ListBasedPriorityQueue(); for(int i=0; i