Skip to content

Commit

Permalink
Start work on separating model interactions from the view.
Browse files Browse the repository at this point in the history
  • Loading branch information
dwm10005 committed Mar 30, 2015
1 parent af42b10 commit ffbe474
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/TowerDefenseGame.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import java.util.Deque;

/**
* Represents a game of tower defense, encapsulating player data and directs actions of in-game units.
*
*/
public class TowerDefenseGame {

private Deque minionSchedule;
private boolean gameOver;
private MapTowerDefense map;

public TowerDefenseGame(Deque minionSchedule, MapTowerDefense map)
{
gameOver = false;
this.map = map;
}

public void mainLoop()
{
//Need to decide on the best way to implement updates in this cycle. Could do it in a tick-based manner, where you sleep x amount of time and then update all your shit.
//I'd prefer to update the model without delay, but that requires timing units and game interactions in another way so that it doesn't run at super-speed.
int i = 0;
while (!gameOver)
{
map.getMF().assignAllDamage();

if (i > 63) {
map.createMinion(MinionTypes.BASIC);
i = 0;
}
}
}
}

0 comments on commit ffbe474

Please sign in to comment.