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 List<ZPM> zpmContainer;
|
||||||
private Box boxLifted;
|
private Box boxLifted;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void destroy() {
|
||||||
|
destroyed = true;
|
||||||
|
if(hasBox())
|
||||||
|
boxLifted.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
public Player(String name, Tile startTile, Direction startDirection) {
|
public Player(String name, Tile startTile, Direction startDirection) {
|
||||||
super(name, startTile, startDirection);
|
super(name, startTile, startDirection);
|
||||||
@ -18,14 +24,17 @@ public class Player extends PlayerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void boxLift() {
|
public void boxLift() {
|
||||||
boxLifted = (Box) currentTile.getAdjacentTile(facingDirection).getABox();
|
if(!isDestroyed())
|
||||||
|
boxLifted = (Box) currentTile.getAdjacentTile(facingDirection).getABox();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void boxDrop() {
|
public void boxDrop() {
|
||||||
Tile target = currentTile.getAdjacentTile(facingDirection);
|
if(!isDestroyed()) {
|
||||||
if(target.isSteppable()) {
|
Tile target = currentTile.getAdjacentTile(facingDirection);
|
||||||
target.putABox(boxLifted);
|
if (target.isSteppable()) {
|
||||||
boxLifted = null;
|
target.putABox(boxLifted);
|
||||||
|
boxLifted = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,7 +44,8 @@ public class Player extends PlayerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void shootStargate(Stargate stargate) {
|
public void shootStargate(Stargate stargate) {
|
||||||
this.currentTile.getAdjacentTile(facingDirection).spawnStargate(stargate, facingDirection);
|
if(!isDestroyed())
|
||||||
|
this.currentTile.getAdjacentTile(facingDirection).spawnStargate(stargate, facingDirection);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getZPMCount(){
|
public int getZPMCount(){
|
||||||
|
@ -31,16 +31,16 @@ public class PlayerBase implements Destroyable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void move(Direction direction) {
|
public void move(Direction direction) {
|
||||||
this.setFacingDirection(direction);
|
if(!isDestroyed()) {
|
||||||
Tile adjtile = this.getCurrentTile().getAdjacentTile(direction);
|
this.setFacingDirection(direction);
|
||||||
|
Tile adjtile = this.getCurrentTile().getAdjacentTile(direction);
|
||||||
|
|
||||||
if (adjtile != null)
|
if (adjtile != null) {
|
||||||
{
|
if (adjtile.isSteppable()) {
|
||||||
if (adjtile.isSteppable())
|
currentTile.onExit(this);
|
||||||
{
|
setCurrentTile(adjtile);
|
||||||
currentTile.onExit(this);
|
adjtile.onEntry(this);
|
||||||
setCurrentTile(adjtile);
|
}
|
||||||
adjtile.onEntry(this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@ public class PlayerBaseDrawer extends AbstractDrawer implements Drawer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw() throws IOException {
|
public void draw() throws IOException {
|
||||||
|
|
||||||
switch(playerbase.name){
|
switch(playerbase.name){
|
||||||
case "Replicator":
|
case "Replicator":
|
||||||
switch(playerbase.facingDirection){
|
switch(playerbase.facingDirection){
|
||||||
@ -29,7 +28,9 @@ public class PlayerBaseDrawer extends AbstractDrawer implements Drawer {
|
|||||||
changeImage("Replicator_Left.png");
|
changeImage("Replicator_Left.png");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(playerbase.isDestroyed())
|
||||||
|
changeImage("Empty.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -87,6 +87,8 @@ public class PlayerDrawer extends AbstractDrawer implements Drawer {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(player.isDestroyed())
|
||||||
|
changeImage("Empty.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user