diff --git a/bin/net/grosinger/nomads/InitializeGame.class b/bin/net/grosinger/nomads/InitializeGame.class index 4c2177c..cbd8dd3 100644 Binary files a/bin/net/grosinger/nomads/InitializeGame.class and b/bin/net/grosinger/nomads/InitializeGame.class differ diff --git a/bin/net/grosinger/nomads/Nomads.class b/bin/net/grosinger/nomads/Nomads.class index ccdb9e2..9bb175f 100644 Binary files a/bin/net/grosinger/nomads/Nomads.class and b/bin/net/grosinger/nomads/Nomads.class differ diff --git a/bin/net/grosinger/nomads/World.class b/bin/net/grosinger/nomads/World.class index 8350017..d0434b3 100644 Binary files a/bin/net/grosinger/nomads/World.class and b/bin/net/grosinger/nomads/World.class differ diff --git a/src/net/grosinger/nomads/InitializeGame.java b/src/net/grosinger/nomads/InitializeGame.java index 5444f2e..b641769 100644 --- a/src/net/grosinger/nomads/InitializeGame.java +++ b/src/net/grosinger/nomads/InitializeGame.java @@ -29,8 +29,7 @@ public class InitializeGame { * @throws IOException * @throws ClassNotFoundException */ - public static void initializeDrones() throws ClassNotFoundException, - IOException { + public static void initializeDrones() throws ClassNotFoundException, IOException { if (Nomads.DEBUGSTATUS) System.out.println("Loading the drones into world..."); /* @@ -53,11 +52,10 @@ public class InitializeGame { if (Nomads.DEBUGSTATUS) System.out.println("Loading " + filename); - File file = new File(System.getProperty("user.dir") + "/drones/" - + filename); + File file = new File(System.getProperty("user.dir") + "/drones/" + filename); - URLClassLoader clazzLoader = URLClassLoader - .newInstance(new URL[] { file.toURI().toURL() }); + URLClassLoader clazzLoader = URLClassLoader.newInstance(new URL[] { file.toURI() + .toURL() }); // System.class.getClassLoader() JarFile jarFile = new JarFile(file); @@ -68,8 +66,8 @@ public class InitializeGame { if (element.getName().endsWith(className + ".class")) { try { @SuppressWarnings("rawtypes") - Class c = clazzLoader.loadClass(element.getName() - .replaceAll(".class", "").replaceAll("/", ".")); + Class c = clazzLoader.loadClass(element.getName().replaceAll(".class", "") + .replaceAll("/", ".")); // Create new GameObject GameObject newGameObject = (GameObject) c.newInstance(); @@ -151,8 +149,7 @@ public class InitializeGame { Building townHall = new Building(Structure.TOWNHALL, 30, 40, null); Building upgradeShop = new Building(Structure.UPGRADESHOP, 30, 60, null); - Building policeStation = new Building(Structure.POLICESTATION, 50, 40, - null); + Building policeStation = new Building(Structure.POLICESTATION, 50, 40, null); Building RepairShop = new Building(Structure.REPAIRSHOP, 50, 60, null); if (Nomads.DEBUGSTATUS) @@ -170,10 +167,10 @@ public class InitializeGame { /** * Generate the money piles and place them on the map */ - public static void initializeMoneyPiles() { + public static void initializeMoneyPiles(World awesomeWorld) { for (int i = 0; i < Nomads.MONEYPILES; i++) { MoneyPile newPile = new MoneyPile(); - Nomads.awesomeWorld.setObjectRandom(newPile); + awesomeWorld.setObjectRandom(newPile); } } } diff --git a/src/net/grosinger/nomads/Nomads.java b/src/net/grosinger/nomads/Nomads.java index 868b705..5d21a40 100644 --- a/src/net/grosinger/nomads/Nomads.java +++ b/src/net/grosinger/nomads/Nomads.java @@ -80,7 +80,13 @@ public class Nomads { // Generate and place all required buildings into world if (DEBUGSTATUS) - InitializeGame.initializeBuildngs(awesomeWorld); + System.out.println("Initializing and placing buildings"); + InitializeGame.initializeBuildngs(awesomeWorld); + + // Generate and place MoneyPiles + if (DEBUGSTATUS) + System.out.println("Initializing and placing MoneyPiles"); + InitializeGame.initializeMoneyPiles(awesomeWorld); // Check to make sure allTeams has been set up properly if (allTeams == null) { diff --git a/src/net/grosinger/nomads/World.java b/src/net/grosinger/nomads/World.java index 94eeebb..e8f86a8 100644 --- a/src/net/grosinger/nomads/World.java +++ b/src/net/grosinger/nomads/World.java @@ -173,6 +173,7 @@ public class World { * GameObject to be placed */ public void setObjectRandom(GameObject newItem) { + // TODO - Able to go out of bounds // Min + (int)(Math.random() * ((Max - Min) + 1)) int randX = 0 + (int) (Math.random() * ((getWorldSize() - 0) + 1)); int randY = 0 + (int) (Math.random() * ((getWorldSize() - 0) + 1)); @@ -370,13 +371,15 @@ public class World { g2d.setColor(Color.black); g2d.fillRect(j * 10, i * 10, 10, 10); } else if (objectHere instanceof MoneyPile) { - // TODO - Implement mapping of MoneyPiles - // Should be black since they are world owned but a - // different shape than anything else + // Green Rectangles represent a MoneyPile + Color color = Color.green; + g2d.setColor(color); + g2d.fillRect(j * 10, i * 10, 10, 10); } else if (objectHere instanceof Objective) { - // TODO - Implement mapping of Objective - // Should be black since they are world owned but a - // different shape than anything else + // Black Oval represents an Objective + Color color = Color.black; + g2d.setColor(color); + g2d.fillRect(j * 10, i * 10, 10, 10); } } }