This commit is contained in:
Anthony Calosa
2023-03-19 21:03:51 +08:00
parent 1bc8abf7e1
commit a91845c444
4 changed files with 31 additions and 2 deletions

View File

@@ -70,8 +70,8 @@ public class GameScene extends HudScene {
if (skipRoads) {
location = forHeader ? "Waste Map" : "waste";
} else {
//should load while walking on "road"
location = "";
//current workaround to get the POI town name
location = WorldStage.getInstance().getBoundary();
}
else {
BiomeData data = biomeData.get(currentBiome);

View File

@@ -584,6 +584,7 @@ public class GameHUD extends Stage {
case "town":
changeBGM(MusicPlaylist.TOWN);
break;
case "dungeon":
case "cave":
changeBGM(MusicPlaylist.CAVE);
break;

View File

@@ -63,6 +63,30 @@ public class MapSprite extends Actor {
return actorGroup;
}
public static String getBoundaryName(int chunkX, int chunkY) {
String boundary = "";
List<PointOfInterest> poi = WorldSave.getCurrentSave().getWorld().getPointsOfInterest(chunkX, chunkY);
for (PointOfInterest p : poi) {
if ("town".equalsIgnoreCase(p.getData().type)) {
if (p.getData().name.startsWith("Waste"))
boundary = "waste";
else if (p.getData().name.startsWith("Plains"))
boundary = "white";
else if (p.getData().name.startsWith("Forest"))
boundary = "green";
else if (p.getData().name.startsWith("Island"))
boundary = "blue";
else if (p.getData().name.startsWith("Mountain"))
boundary = "red";
else if (p.getData().name.startsWith("Swamp"))
boundary = "black";
break;
}
}
return boundary;
}
//BitmapFont font;
@Override
public void draw(Batch batch, float parentAlpha) {

View File

@@ -294,6 +294,10 @@ public class WorldStage extends GameStage implements SaveFileContent {
background.loadChunk(pos.x, pos.y);
handlePointsOfInterestCollision();
}
public String getBoundary() {
GridPoint2 pos = background.translateFromWorldToChunk(player.getX(), player.getY());
return MapSprite.getBoundaryName(pos.x, pos.y);
}
@Override
public void leave() {