From ffbe474844111d40106b5434345c08e1195a101e Mon Sep 17 00:00:00 2001 From: student2395 Date: Mon, 30 Mar 2015 15:24:54 -0400 Subject: [PATCH] Start work on separating model interactions from the view. --- src/TowerDefenseGame.java | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/TowerDefenseGame.java diff --git a/src/TowerDefenseGame.java b/src/TowerDefenseGame.java new file mode 100644 index 0000000..250e608 --- /dev/null +++ b/src/TowerDefenseGame.java @@ -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; + } + } + } +}