-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start work on separating model interactions from the view.
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
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
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; | ||
} | ||
} | ||
} | ||
} |