Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…GProject

Conflicts:
	MerchantRPGCSE2102/src/tests/MockGame.java
  • Loading branch information
john committed Apr 11, 2015
2 parents 1ffa3cd + 5248399 commit e792acc
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions MerchantRPGCSE2102/src/tests/MockGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
}
}

Expand Down

0 comments on commit e792acc

Please sign in to comment.