diff --git a/MerchantRPGCSE2102/src/tests/MockGame.java b/MerchantRPGCSE2102/src/tests/MockGame.java index 237ec45..c7b8877 100644 --- a/MerchantRPGCSE2102/src/tests/MockGame.java +++ b/MerchantRPGCSE2102/src/tests/MockGame.java @@ -3,15 +3,15 @@ import javax.swing.JFrame; import model.Map; -import model.Merchant; import model.Player; import view.MapUI; import controller.RPGame; +import model.Merchant; +import model.Player; public class MockGame { - public static void main(String[] args) throws InterruptedException { - + public static void main(String[] args) throws InterruptedException { RPGame rpg = new RPGame(); // SETTING UP PLAYER AND MERCHANT Player player = new Player("Player", 0, null); @@ -20,15 +20,12 @@ public static void main(String[] args) throws InterruptedException { Merchant merch3 = new Merchant("Sam", 0, null); // CREATING MAP AND INITIALIZE PLAYER AND MERCHANTS - Map map = new Map(30, 40); - map.initializePlayer(player, 15, 20); - map.initializeMerchant(merch1, 15, 0); - map.initializeMerchant(merch2, 29, 20); - map.initializeMerchant(merch3, 15, 39); - - // CREATING JFRAME WINDOW + // This sets up the window for the game which is a 300 by 300 pixels JFrame + Player player = new Player("TestPlayer", 0, null); + Map map = new Map(30, 40); + map.initializePlayer(player, 0, 0); JFrame frame = new JFrame("Merchant RPG"); - + // CREATING MAPUI AND SPRITES MapUI mapui = new MapUI(map, rpg); mapui.createPlayerSprite(15, 20); @@ -38,19 +35,16 @@ public static void main(String[] args) throws InterruptedException { // ADDING MAPUI TO JFRAME frame.add(mapui); - - // SETTING PROPERTIES OF JFRAME frame.setSize(RPGame.WIDTH, RPGame.HEIGHT); frame.setResizable(false); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); - // MAIN GAME LOOP while (true) { mapui.move(); mapui.repaint(); - Thread.sleep(100/12); // Controls the speed of the game (currently 120 frames/second) + Thread.sleep(10); } }