removed unnecessary code
This commit is contained in:
@@ -15,7 +15,6 @@ public class Player extends Entity {
|
||||
|
||||
public final int screenX;
|
||||
public final int screenY;
|
||||
public int hasKey = 0;
|
||||
|
||||
public Player(GamePanel panel, KeyHandler keyH) {
|
||||
this.panel = panel;
|
||||
@@ -97,34 +96,7 @@ public class Player extends Entity {
|
||||
|
||||
public void pickObject(int index) {
|
||||
if(index == 999) return;
|
||||
switch(panel.obj[index].name.toLowerCase()) {
|
||||
case "key":
|
||||
panel.playSE(1);
|
||||
hasKey++;
|
||||
panel.obj[index] = null;
|
||||
panel.ui.showMessage("You got a key!");
|
||||
break;
|
||||
case "door":
|
||||
if(hasKey > 0) {
|
||||
panel.playSE(3);
|
||||
panel.obj[index] = null;
|
||||
hasKey--;
|
||||
panel.ui.showMessage("You opened the door!");
|
||||
}
|
||||
else panel.ui.showMessage("You need a key!");
|
||||
break;
|
||||
case "boots":
|
||||
panel.playSE(2);
|
||||
speed += 1;
|
||||
panel.obj[index] = null;
|
||||
panel.ui.showMessage("Speed up!");
|
||||
break;
|
||||
case "chest":
|
||||
panel.ui.gameFinished = true;
|
||||
panel.stopMusic();
|
||||
panel.playSE(4);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void draw(Graphics2D graphics2d) {
|
||||
|
||||
Reference in New Issue
Block a user