diff --git a/.project b/.project index 9b62d4c..901f736 100644 --- a/.project +++ b/.project @@ -10,8 +10,14 @@ + + net.sourceforge.metrics.builder + + + org.eclipse.jdt.core.javanature + net.sourceforge.metrics.nature diff --git a/README.md b/README.md new file mode 100644 index 0000000..23d1a0c --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +TowerDefense +============ + +Play the most exiting thing since sliced bread! Introducing the best Tower Defense gamed you've ever played. Does your tower defense game have characteres such as Sonic, the Depsicable Me minion, and a Speedy Gonzalez? I didn't think so. Does it have some of the best tower models rendered from industry-level computer graphics, that is java.awt.swing? Nope. Well try your hand today and use some of the best tower-power available. See if you can overcome the hordes of minions itching to knock down your Nexus! + +From the creative talents of CSE 2102 students +Mock Tower Defense Game (R) All Rights Reserved. +Unauthorized Duplication Is A Violation Of Applicable Laws and punishable with at least 1 hour of playing this game. + diff --git a/src/Main.java b/src/Main.java index b26f413..398b6c5 100644 --- a/src/Main.java +++ b/src/Main.java @@ -1,4 +1,5 @@ import java.awt.*; + import javax.swing.*; public class Main extends JFrame{ @@ -29,6 +30,13 @@ public class Main extends JFrame{ frame.setSize(860,670); frame.setVisible(true); + map.createMinion(MinionTypes.BASIC); + try { + Thread.sleep(50); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } map.createMinion(MinionTypes.BASIC); mg.step(); } diff --git a/src/MockGui.java b/src/MockGui.java index 3c2d58a..8c2830a 100644 --- a/src/MockGui.java +++ b/src/MockGui.java @@ -218,7 +218,7 @@ public class MockGui extends JPanel{ //if Basic tower is attacking, draw dots to where minion is public void drawAllBasicAttacks(TowerFactory TF, Graphics g){ - for(int i = 0; i < TF.getNum(); i++){ + for(int i = 1; i < TF.getNum(); i++){ if(TF.getTowerArray()[i].basicDealDamage() && TF.getTowerArray()[i].type == TowerTypes.BASIC){ int towerDotX = (TF.getTowerArray()[i]._xlocation * 32) + 15; int towerDotY = (TF.getTowerArray()[i]._ylocation *32) + 15; @@ -244,7 +244,7 @@ public class MockGui extends JPanel{ } public void drawAllAOEAttacks(TowerFactory TF, Graphics g){ - for(int i = 0; i < TF.getNum(); i++){ + for(int i = 1; i < TF.getNum(); i++){ if( TF.getTowerArray()[i].basicDealDamage() && TF.getTowerArray()[i].type == TowerTypes.AOE){ drawAOEAttack((TF.getTowerArray()[i]._xlocation * 32) + 15, (TF.getTowerArray()[i]._ylocation *32) + 15,TF.getTowerArray()[i].getRange(), g); diff --git a/src/TowerFactory.java b/src/TowerFactory.java index 4c296db..fe9f43d 100644 --- a/src/TowerFactory.java +++ b/src/TowerFactory.java @@ -33,7 +33,7 @@ public class TowerFactory { int total = 0; while (i < quantity) { if (0 == (towerarray[i].type.compareTo(TowerTypes.AOE))) { - total += towerarray[i].dealDamage(x, y); + total += towerarray[i].inRange(x, y); } i++; } diff --git a/src/TowerMock.java b/src/TowerMock.java index c9be20e..eb3151a 100644 --- a/src/TowerMock.java +++ b/src/TowerMock.java @@ -32,6 +32,7 @@ public class TowerMock{ _isTower = isTower; if (!isTower) { health = 20; + _power = 0; } this.type=type; @@ -77,7 +78,7 @@ public class TowerMock{ return false; } if (m.isAlive()) { - if (1 == dealDamage(m.getX(), m.getY())) { + if (1 == inRange(m.getX(), m.getY())) { currentTarget = m; return true; } @@ -89,7 +90,7 @@ public class TowerMock{ - public int dealDamage(int x, int y) { + public int inRange(int x, int y) { int deltax = (32*_xlocation - x); int deltay = (32*_ylocation - y); int dist2 = deltax*deltax + deltay*deltay;