Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
rename dealdamage
  • Loading branch information
ssl10003 committed Apr 24, 2015
1 parent fb00090 commit 4590234
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .project
Expand Up @@ -10,8 +10,14 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>net.sourceforge.metrics.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>net.sourceforge.metrics.nature</nature>
</natures>
</projectDescription>
8 changes: 8 additions & 0 deletions src/Main.java
@@ -1,4 +1,5 @@
import java.awt.*;

import javax.swing.*;

public class Main extends JFrame{
Expand Down Expand Up @@ -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();

Expand Down
4 changes: 2 additions & 2 deletions src/MockGui.java
Expand Up @@ -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;
Expand All @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion src/TowerFactory.java
Expand Up @@ -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++;
}
Expand Down
5 changes: 3 additions & 2 deletions src/TowerMock.java
Expand Up @@ -35,6 +35,7 @@ public class TowerMock{
_isTower = isTower;
if (!isTower) {
health = 20;
_power = 0;
}

this.type=type;
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down

0 comments on commit 4590234

Please sign in to comment.