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) { if (skipRoads) {
location = forHeader ? "Waste Map" : "waste"; location = forHeader ? "Waste Map" : "waste";
} else { } else {
//should load while walking on "road" //current workaround to get the POI town name
location = ""; location = WorldStage.getInstance().getBoundary();
} }
else { else {
BiomeData data = biomeData.get(currentBiome); BiomeData data = biomeData.get(currentBiome);

View File

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

View File

@@ -63,6 +63,30 @@ public class MapSprite extends Actor {
return actorGroup; 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; //BitmapFont font;
@Override @Override
public void draw(Batch batch, float parentAlpha) { 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); background.loadChunk(pos.x, pos.y);
handlePointsOfInterestCollision(); handlePointsOfInterestCollision();
} }
public String getBoundary() {
GridPoint2 pos = background.translateFromWorldToChunk(player.getX(), player.getY());
return MapSprite.getBoundaryName(pos.x, pos.y);
}
@Override @Override
public void leave() { public void leave() {