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/model/TowerDefenseGame.java
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
35 lines (30 sloc)
940 Bytes
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
package model; | |
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; | |
} | |
} | |
} | |
} |