diff --git a/src/ShadowTreasure.java b/src/ShadowTreasure.java index 814a4bf73a0c175eeccfd7aa70c3fdcc91846893..cc66b3cfdca229e76bc24ee264919a5c7be02d75 100644 --- a/src/ShadowTreasure.java +++ b/src/ShadowTreasure.java @@ -13,7 +13,7 @@ import java.util.Scanner; * An example Bagel game. */ public class ShadowTreasure extends AbstractGame { - private String filename = "res/IO/environment.csv"; + private String filename = "test/test2/environment.csv"; private final Image background = new Image("res/images/background.png"); private Player player; private Zombie zombie; @@ -90,12 +90,10 @@ public class ShadowTreasure extends AbstractGame { double speed = 10; double playerToZombie = player.getPosition().distanceTo(zombie.getPosition()); double playerToSandwich = player.getPosition().distanceTo(sandwich.getPosition()); - double distDiff = playerToZombie - playerToSandwich; int energy = player.getEnergy(); Vector2 direction; - if (sandwich.isEaten() || (distDiff <= 0 && energy >= 3)) { -// if (sandwich.isEaten() || energy >= 3) { + if (sandwich.isEaten() || energy >= 3) { // player move to zombie direction = zombie.getPosition().asVector().sub(player.getPosition().asVector()); direction = direction.normalised(); @@ -107,12 +105,8 @@ public class ShadowTreasure extends AbstractGame { player.updateEnergy(-3); Window.close(); // terminate game if player meets zombie } -// if (playerToSandwich <= 50) { -// player.eat(sandwich); -// } - } else if (distDiff > 0 || player.getEnergy() < 3) { -// } else if (player.getEnergy() < 3) { + } else if (player.getEnergy() < 3) { // player move to sandwich direction = sandwich.getPosition().asVector().sub(player.getPosition().asVector()); direction = direction.normalised(); @@ -120,9 +114,6 @@ public class ShadowTreasure extends AbstractGame { player.setY(player.getY() + speed * direction.y); playerToSandwich = player.getPosition().distanceTo(sandwich.getPosition()); -// if (playerToZombie <= 50) { -// player.updateEnergy(-3); -// Window.close(); // terminate game if player meets zombie if (playerToSandwich <= 50) { player.eat(sandwich); } diff --git a/target/classes/ShadowTreasure.class b/target/classes/ShadowTreasure.class index 44025b593df3de73b399bf3b39f28aa5ff878a1b..03a49037675f7bd6fd062c62e2b3fa9ef35a2881 100644 Binary files a/target/classes/ShadowTreasure.class and b/target/classes/ShadowTreasure.class differ