Ver Fonte

changed hill

SlightlyObscure há 4 anos atrás
pai
commit
3ee92c664b
2 ficheiros alterados com 4 adições e 2 exclusões
  1. BIN
      resources/tiles.png
  2. 4 2
      src/pathgame/algorithm/DijkstraMagic.java

BIN
resources/tiles.png


+ 4 - 2
src/pathgame/algorithm/DijkstraMagic.java

@@ -3,11 +3,13 @@ package pathgame.algorithm;
 
 import pathgame.gameplay.PlayerAbilities;
 import pathgame.tilemap.TileMap;
+import pathgame.tilemap.Tiles;
 
 import java.util.ArrayList;
 
 public class DijkstraMagic {
-    private int townID = 18;
+    private int townID = Tiles.TOWN.getId();
+    private int startID = Tiles.HOME_TOWN.getId();
     private ArrayList<Coord> towns = new ArrayList<>();
     private TileMap map;
     private Node2D[][] weightMap;
@@ -330,7 +332,7 @@ public class DijkstraMagic {
 
                 //actual implementation - find towns; townID needs to be set to correct value
 
-                if(map.getTile(x, y).getId() == townID) {
+                if(map.getTile(x, y).getId() == townID || map.getTile(x, y).getId() == startID) {
                     towns.add(new Coord(x, y));
                 }