From d15f5aec40698621bfd745740b0492ff7990464f Mon Sep 17 00:00:00 2001 From: Solomon S Lin Date: Fri, 24 Apr 2015 08:47:45 -0400 Subject: [PATCH 1/3] Create README.md Beats the old description --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..2084373 --- /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 the industry-level computer graphics has to offer, 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. + From 2214a6622106e05e16439d37e3d18d27af950b8e Mon Sep 17 00:00:00 2001 From: Solomon S Lin Date: Fri, 24 Apr 2015 08:48:52 -0400 Subject: [PATCH 2/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2084373..23d1a0c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ 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 the industry-level computer graphics has to offer, 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! +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. From 45902348e20792c4103cf101acdb996114572ee0 Mon Sep 17 00:00:00 2001 From: ssl10003 Date: Fri, 24 Apr 2015 11:37:39 -0400 Subject: [PATCH 3/3] rename dealdamage --- .project | 6 ++++++ src/Main.java | 8 ++++++++ src/MockGui.java | 4 ++-- src/TowerFactory.java | 2 +- src/TowerMock.java | 5 +++-- 5 files changed, 20 insertions(+), 5 deletions(-) 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/src/Main.java b/src/Main.java index 16a4ab8..bd0661b 100644 --- a/src/Main.java +++ b/src/Main.java @@ -1,4 +1,5 @@ import java.awt.*; + import javax.swing.*; public class Main extends JFrame{ @@ -34,6 +35,13 @@ public class Main extends JFrame{ frame.setSize(650,720); 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 5739418..7da67b8 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, 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 d51238c..b62ac3f 100644 --- a/src/TowerMock.java +++ b/src/TowerMock.java @@ -35,6 +35,7 @@ public class TowerMock{ _isTower = isTower; if (!isTower) { health = 20; + _power = 0; } this.type=type; @@ -78,7 +79,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; } @@ -90,7 +91,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;