Update TileMapScene.java

This commit is contained in:
Anthony Calosa
2022-08-13 13:07:42 +08:00
committed by GitHub
parent f33ec785b0
commit 659f20edff

View File

@@ -8,8 +8,11 @@ import forge.adventure.pointofintrest.PointOfInterest;
import forge.adventure.stage.MapStage; import forge.adventure.stage.MapStage;
import forge.adventure.stage.PointOfInterestMapRenderer; import forge.adventure.stage.PointOfInterestMapRenderer;
import forge.adventure.util.Config; import forge.adventure.util.Config;
import forge.adventure.util.Current;
import forge.adventure.util.TemplateTmxMapLoader; import forge.adventure.util.TemplateTmxMapLoader;
import forge.adventure.world.WorldSave; import forge.adventure.world.WorldSave;
import forge.sound.SoundEffectType;
import forge.sound.SoundSystem;
/** /**
* Scene that will render tiled maps. * Scene that will render tiled maps.
@@ -19,6 +22,7 @@ public class TileMapScene extends HudScene {
TiledMap map; TiledMap map;
PointOfInterestMapRenderer tiledMapRenderer; PointOfInterestMapRenderer tiledMapRenderer;
private String nextMap; private String nextMap;
private boolean autoheal = false;
private float cameraWidth = 0f, cameraHeight = 0f; private float cameraWidth = 0f, cameraHeight = 0f;
public TileMapScene() { public TileMapScene() {
@@ -46,6 +50,10 @@ public class TileMapScene extends HudScene {
} }
stage.act(Gdx.graphics.getDeltaTime()); stage.act(Gdx.graphics.getDeltaTime());
hud.act(Gdx.graphics.getDeltaTime()); hud.act(Gdx.graphics.getDeltaTime());
if (autoheal) { //todo add simple bg animation or effect also add check if auto heal is needed if player has full life so sound don't keep playing
SoundSystem.instance.play(SoundEffectType.Enchantment, false);
autoheal = false;
}
} }
@Override @Override
@@ -80,6 +88,11 @@ public class TileMapScene extends HudScene {
@Override @Override
public void enter() { public void enter() {
super.enter(); super.enter();
if (inTown()) {
// auto heal
Current.player().fullHeal();
autoheal = true;
}
} }
public void load(PointOfInterest point) { public void load(PointOfInterest point) {