added so player can winn
This commit is contained in:
parent
92e08382a8
commit
556e2f4866
13 changed files with 126 additions and 9 deletions
|
|
@ -22,6 +22,7 @@ public abstract class GameEntity{
|
|||
public int getLife(){
|
||||
return life;
|
||||
}
|
||||
|
||||
public abstract boolean isTerrain();
|
||||
|
||||
public abstract Vector2i getPos();
|
||||
|
|
@ -93,6 +94,7 @@ public abstract class GameEntity{
|
|||
public void move(boolean play, int x, int y) {
|
||||
|
||||
}
|
||||
public abstract void remove();
|
||||
|
||||
public abstract void update();
|
||||
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ public abstract class Building extends GameEntity{
|
|||
* Removes this building from the game.
|
||||
*
|
||||
*/
|
||||
public void removeBuilding(){
|
||||
public void remove(){
|
||||
unitNode.remove(getSprite());
|
||||
getPlayer().removeUnit(this);
|
||||
InGameState.getMap().removeBuildPos(oldPos.getX(), oldPos.getY(), this.size);
|
||||
|
|
@ -162,7 +162,7 @@ public abstract class Building extends GameEntity{
|
|||
public void update() {
|
||||
if(getLife() <= 0) {
|
||||
destroyed();
|
||||
removeBuilding();
|
||||
remove();
|
||||
}
|
||||
|
||||
if(!buildQueue.isEmpty() && getPlayer().getKredits() >= buildQueue.peek().getPrice()){
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public abstract class MapEntity extends Unit{
|
|||
|
||||
public void update() {
|
||||
if(getLife()<=0) {
|
||||
removeUnit();
|
||||
remove();
|
||||
}
|
||||
}
|
||||
public void move(boolean play, int x, int y){
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ public abstract class Unit extends GameEntity{
|
|||
public abstract void init();
|
||||
|
||||
|
||||
public void removeUnit(){
|
||||
public void remove(){
|
||||
unitNode.remove(getSprite());
|
||||
getPlayer().removeUnit(this);
|
||||
InGameState.getMap().removePos(oldPos.getX(), oldPos.getY());
|
||||
|
|
@ -235,7 +235,7 @@ public abstract class Unit extends GameEntity{
|
|||
weponTimer++;
|
||||
if(getLife()<=0) {
|
||||
destroyed();
|
||||
removeUnit();
|
||||
remove();
|
||||
}
|
||||
else if(moveTo != null) {
|
||||
Vector2i moveVect = new Vector2i((int)moveTo.getX(),(int)moveTo.getY());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue