Implemented initial player death
This commit is contained in:
parent
7f98954211
commit
1974396f61
@ -7,6 +7,12 @@ public class Player extends PlayerBase {
|
||||
private List<ZPM> zpmContainer;
|
||||
private Box boxLifted;
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
destroyed = true;
|
||||
if(hasBox())
|
||||
boxLifted.destroy();
|
||||
}
|
||||
|
||||
public Player(String name, Tile startTile, Direction startDirection) {
|
||||
super(name, startTile, startDirection);
|
||||
@ -18,16 +24,19 @@ public class Player extends PlayerBase {
|
||||
}
|
||||
|
||||
public void boxLift() {
|
||||
if(!isDestroyed())
|
||||
boxLifted = (Box) currentTile.getAdjacentTile(facingDirection).getABox();
|
||||
}
|
||||
|
||||
public void boxDrop() {
|
||||
if(!isDestroyed()) {
|
||||
Tile target = currentTile.getAdjacentTile(facingDirection);
|
||||
if(target.isSteppable()) {
|
||||
if (target.isSteppable()) {
|
||||
target.putABox(boxLifted);
|
||||
boxLifted = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pickZPM(Tile tile) {
|
||||
@ -35,6 +44,7 @@ public class Player extends PlayerBase {
|
||||
}
|
||||
|
||||
public void shootStargate(Stargate stargate) {
|
||||
if(!isDestroyed())
|
||||
this.currentTile.getAdjacentTile(facingDirection).spawnStargate(stargate, facingDirection);
|
||||
}
|
||||
|
||||
|
@ -31,19 +31,19 @@ public class PlayerBase implements Destroyable {
|
||||
}
|
||||
|
||||
public void move(Direction direction) {
|
||||
if(!isDestroyed()) {
|
||||
this.setFacingDirection(direction);
|
||||
Tile adjtile = this.getCurrentTile().getAdjacentTile(direction);
|
||||
|
||||
if (adjtile != null)
|
||||
{
|
||||
if (adjtile.isSteppable())
|
||||
{
|
||||
if (adjtile != null) {
|
||||
if (adjtile.isSteppable()) {
|
||||
currentTile.onExit(this);
|
||||
setCurrentTile(adjtile);
|
||||
adjtile.onEntry(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void pickZPM(Tile tile) { /* PlayerBase does not collect ZPM modules */ }
|
||||
|
||||
|
@ -12,7 +12,6 @@ public class PlayerBaseDrawer extends AbstractDrawer implements Drawer {
|
||||
|
||||
@Override
|
||||
public void draw() throws IOException {
|
||||
|
||||
switch(playerbase.name){
|
||||
case "Replicator":
|
||||
switch(playerbase.facingDirection){
|
||||
@ -30,6 +29,8 @@ public class PlayerBaseDrawer extends AbstractDrawer implements Drawer {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(playerbase.isDestroyed())
|
||||
changeImage("Empty.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -87,6 +87,8 @@ public class PlayerDrawer extends AbstractDrawer implements Drawer {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(player.isDestroyed())
|
||||
changeImage("Empty.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user