Skip to content

Commit

Permalink
Adding death on getting stuck in anything collidable (doors)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramielrowe committed Apr 8, 2012
1 parent c12e6f6 commit ca57dc6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/com/vulcastudios/TestGame.java
Expand Up @@ -133,6 +133,9 @@ public void checkObjects(Zombie z){
String trimmedName = doorName.trim();
Door door = this.getCurrentLevel().getDoors().get(trimmedName);
door.setOpen(!door.isOpen());
if(!door.isOpen() && this.getCurrentLevel().getPlayer().getBounds().intersects(door.getBounds())){
this.getCurrentLevel().getPlayer().setAlive(false);
}
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/com/vulcastudios/actors/Player.java
Expand Up @@ -42,6 +42,10 @@ public Player(ResourceManager rm, int xPos, int yPos){

public void update(GameContainer container, StateBasedGame game, int delta){

if(((TestGame)game).checkCollision(this)){
this.setAlive(false);
}

float oldX = this.getXPos();
float oldY = this.getYPos();

Expand Down

0 comments on commit ca57dc6

Please sign in to comment.