Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
TowerDefense/src/MinionTypes.java
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
103 lines (88 sloc)
1.74 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum MinionTypes { | |
BASIC (255, 1, 1); | |
private int health, attackDamage, movementSpeed; | |
MinionTypes(int health, int attackDamage, int movementSpeed) { | |
this.health = health; | |
this.attackDamage = attackDamage; | |
this.movementSpeed = movementSpeed; | |
} | |
public int getHealth() { | |
return health; | |
} | |
public int getAttackDamage() { | |
return attackDamage; | |
} | |
public int getMovementSpeed() { | |
return movementSpeed; | |
} | |
/* | |
public int getType() { | |
return type; | |
} | |
*/ | |
/* | |
public int findDirection() { | |
if (visits == map.getNum()) { | |
// CALL TO MAKE NEXUS LOSE HEALTH | |
return -1; | |
} else { | |
int xGoal = map.getNodes()[visits][0]; | |
int yGoal = map.getNodes()[visits][1]; | |
int[] Goals = map.getGui().hash(xGoal, yGoal); | |
xGoal = Goals[0]; | |
yGoal = Goals[1]; | |
if (x == xGoal) { | |
if (y == yGoal) { | |
visits++; | |
return findDirection(); | |
} | |
if (yGoal > y) { | |
// MOVE DOWN | |
return 2; | |
} else { | |
return 0; | |
} | |
} else { | |
if (x > xGoal) { | |
return 3; | |
} else { | |
return 1; | |
} | |
} | |
} | |
} | |
public boolean go() { | |
int direction = findDirection(); | |
if (direction == -1) { | |
alive = false; | |
return map.getTF().getTowerArray()[0].takeDamage(); | |
} | |
if (direction == 0) { | |
y-=movespeed; | |
} | |
if (direction == 1) { | |
x+=movespeed; | |
} | |
if (direction == 2) { | |
y+=movespeed; | |
} | |
if (direction == 3) { | |
x-=movespeed; | |
} | |
return false; | |
} | |
public boolean isAlive() { | |
return alive; | |
} | |
public int getHealth() { | |
return health; | |
} | |
public void minionTakeDamage() { | |
int dam = map.getTF().assignTotalDamage(x, y); | |
health-=dam; | |
if (health <= 0) { | |
alive = false; | |
} | |
} | |
*/ | |
} |