Skip to content

Commit

Permalink
New Minion Types
Browse files Browse the repository at this point in the history
New Restrictions (on tower creation)
New fun!
  • Loading branch information
jrb10014 committed Apr 10, 2015
1 parent 56778fa commit dc7be07
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
10 changes: 10 additions & 0 deletions src/MinionFactory.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import java.util.Random;

public class MinionFactory {
private int X, Y;
private MapTowerDefense map;
private MinionMock[] minions;
private int Max;
private int id;
private Random rand;
private MinionTypes[] types;

public MinionFactory(int x, int y, MapTowerDefense _map) {
X = x;
Expand All @@ -13,6 +16,8 @@ public MinionFactory(int x, int y, MapTowerDefense _map) {
Max = 100;
id = 0;
minions = new MinionMock[Max];
rand = new Random();
types = MinionTypes.values();
}

public void createMinion(MinionTypes type) {
Expand All @@ -22,6 +27,11 @@ public void createMinion(MinionTypes type) {
id++;
}
}
public void createRandominion()
{
this.createMinion(types[rand.nextInt(types.length)]);
}

public MinionMock[] getMinions() {
return minions;
}
Expand Down
7 changes: 5 additions & 2 deletions src/MinionTypes.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@

public enum MinionTypes {

BASIC (255, 1, 1);
//NAME (Health, Attack, Speed)
WEAKLING(100, 1, 1),
BASIC (255, 1, 1),
SPEEDO (100, 1, 4),
SUPERSPEEDO (255, 1, 4);

private int health, attackDamage, movementSpeed;

Expand Down
3 changes: 2 additions & 1 deletion src/MockGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.geom.*;
import java.util.Random;

public class MockGui extends JPanel{
boolean gameOver;
Expand Down Expand Up @@ -45,7 +46,7 @@ public void step() {
map.getMF().assignAllDamage();

if (i > 63) {
map.createMinion(MinionTypes.BASIC);
map.getMF().createRandominion();
i = 0;
}
//
Expand Down
10 changes: 10 additions & 0 deletions src/TowerFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,17 @@ public void createNexus(){
}

public void createBasicTower(int x, int y){
//Checks if there's already a tower here
//TODO make this better
if (quantity < _max) {
int i = 0;
while (i < quantity) {
if ((towerarray[i].getTowerXlocation() == x) && (towerarray[i].getTowerYlocation() == y)) {
System.out.println("CONSEQUENCES WILL NEVER BE THE SAME");
return;
}
i++;
}
towerarray[quantity] = new TowerMock(quantity, x, y, true);
quantity++;
}
Expand Down

0 comments on commit dc7be07

Please sign in to comment.