From d1e522694ac5edcab5e6a2e1033342217964ceaf Mon Sep 17 00:00:00 2001
From: Yiya Zhuang <yiyaz@student.unimelb.edu.au>
Date: Sun, 18 Apr 2021 19:32:28 +1000
Subject: [PATCH] Project1 finished

---
 src/ShadowTreasure.java             |  15 +++------------
 target/classes/ShadowTreasure.class | Bin 5571 -> 5527 bytes
 2 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/src/ShadowTreasure.java b/src/ShadowTreasure.java
index 814a4bf..cc66b3c 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
GIT binary patch
delta 646
zcmX@CJzbmY)W2Q(7#J9=7(+L5Enwu9DoHIa(FYMmn>RAXa7~urspNCxVsvNpU}yB?
zVGw2XnmnK92#*gV11qBrqYfhnqu=CwURlP#$-TT<EWwNna+4?U%5A>M8^FxDk%66o
zi-CcuYO;~wxmc|&41L=eR-18XZDCljjp6bv22N29wuKB;T3Z-qY-4!0jo}+a$*XM)
z-?lOQvf`BF+{VaY#R(Dx;cW~{G$c8<FfwN+Z)0Q!iGc7nh7}r;oRhPKlm#Y$_yT{o
zF$(Ws*teXaaq?0jWgU`C`66_Uc^QM|<g>!I_175^7@jjEF)}bDGqN+JFv>EdG8!|a
zF}g8iF#0oOGDa|DF~%|EGG;R5Gd3|4Fm^H&GR|ixV%*A5%y@#Kl<^`%8RH#>YR1nD
zHB1}~wM?=Mbxi6E^-MMljZ85NEli0FtxS~+ZHy`m3=BaG9E=PMag3&nW(=H+O$<?t
zru85uDDW877}XgVz$|k{3kF7p6^xe{Eg9Jum>705?q{@OWMg1qILEk#(VCHsfsNrh
z<6=e|uz~sv3=E14>;k_TGPM3PI5DuXGjOmo>||zUW@KRa%~1B6q4qaJJOd}AEu$R+
z6QdFX1A`|669W?i0|W1FhRG75QpUXu91ML7JPiF{SBgR880{H#7#J8h7+4t{7}XgV
z88sLf7+4q>88sO=7#%04iW+M>f!xdJ%;>_vz`)1A#OTVv$mk6weHr~37#O%17#RZ?
JgBU{?Bmsz7jw1j7

delta 618
zcmbQPeOR08)W2Q(7#J9=7{fMlEns99D@rZa_w?Vql`)2klOrXw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