Skip to content

Added tower attack animations for Basic and AOE #5

Merged
merged 1 commit into from
Apr 24, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 47 additions & 2 deletions src/MockGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.imageio.ImageIO;

import java.util.Random;


Expand Down Expand Up @@ -79,7 +81,11 @@ public void paint(Graphics g) {
drawAllTowers(map.getTF(), g);
drawAllMinions(map.getMF(), g);
drawPlayerHealth(g);
drawAllBasicAttacks(map.getTF(),g);
drawAllAOEAttacks(map.getTF(),g);

}

public void drawGrid(int x, int y, int gridSize, Graphics g) {
g.setColor(new Color(99, 209, 62));
g.fillRect(0, 0, 32*20, 32*20);
Expand Down Expand Up @@ -203,8 +209,47 @@ public void drawBasicTower(TowerMock tm, int x, int y, Graphics g){
//g.fillRect(x, y, 32, 32);
g.drawImage(tm.getSprite(),x , y, null);

//tm.getTowerXlocation()
//tm.getTowerYlocation()
}

public void drawBasicAttack(int x, int y, Graphics g){
g.setColor(Color.yellow);
g.fillRoundRect(x, y, 7, 7, 7, 7);
}

//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++){
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;
int halfDotX = (((TF.getTowerArray()[i]._xlocation * 32) + 15)+ (TF.getTowerArray()[i].currentTarget.getX() + 15))/2;
int halfDotY = (((TF.getTowerArray()[i]._ylocation * 32) + 15)+ (TF.getTowerArray()[i].currentTarget.getY() + 15))/2;
int minionDotX = TF.getTowerArray()[i].currentTarget.getX() + 15;
int minionDotY = TF.getTowerArray()[i].currentTarget.getY()+15;
drawBasicAttack(towerDotX,towerDotY, g);
drawBasicAttack((towerDotX + halfDotX)/2, (towerDotY + halfDotY)/2, g);
drawBasicAttack(halfDotX, halfDotY, g);
drawBasicAttack((halfDotX + minionDotX)/2, (halfDotY + minionDotY)/2, g);
drawBasicAttack(minionDotX, minionDotY, g);
}
}

}

public void drawAOEAttack(int x, int y, Graphics g){
g.setColor(Color.MAGENTA);
g.drawOval(x-70, y-70, 140, 140);
g.drawOval(x-65, y-65, 130, 130);
g.drawOval(x-60, y-60, 120, 120);
}

public void drawAllAOEAttacks(TowerFactory TF, Graphics g){
for(int i = 0; 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
4 changes: 4 additions & 0 deletions src/TowerTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public String getName() {
return this.toString();
}

public TowerTypes getTowerType(){
return this;
}

public BufferedImage getSprite()
{
return sprite;
Expand Down