Fix crash when jumping straight to WorldMapScene

This commit is contained in:
3wc 2024-02-14 14:25:04 -03:00
parent 010aa5323d
commit 8921f231bd
2 changed files with 7 additions and 7 deletions

View File

@ -17,7 +17,7 @@ class DialogueBox extends h2d.Object {
if (text == null) if (text == null)
text = "NULL"; text = "NULL";
game = Game.current; game = Game.current;
game.root.scene.getH2dObject().getScene().add(this, 1); cast(game.root, h2d.Object).getScene().add(this, 1);
bg = new h2d.ScaleGrid(Res.ui.toTile(), 5, 5, this); bg = new h2d.ScaleGrid(Res.ui.toTile(), 5, 5, this);
bg.colorKey = 0xFF00FF; bg.colorKey = 0xFF00FF;
tf = new h2d.Text(game.font, this); tf = new h2d.Text(game.font, this);

View File

@ -63,12 +63,6 @@ class Game extends hxd.App {
globalEventBus = new EventBus(console); globalEventBus = new EventBus(console);
globalEventBus.subscribe(ChangeSceneEvent, onChangeScene); globalEventBus.subscribe(ChangeSceneEvent, onChangeScene);
#if debug
setGameScene(new WorldMapScene(root));
#else
setGameScene(new TitleScene(root));
#end
font = Res.font.minecraftia_regular_6.toFont(); font = Res.font.minecraftia_regular_6.toFont();
font.resizeTo(24); font.resizeTo(24);
@ -81,6 +75,12 @@ class Game extends hxd.App {
hxd.Res.text.intro.entry.name, hxd.Res.text.intro.entry.name,
]; ];
dialogueManager.load(yarnText, yarnFileNames); dialogueManager.load(yarnText, yarnFileNames);
#if debug
setGameScene(new WorldMapScene(root));
#else
setGameScene(new TitleScene(root));
#end
} }
public function new() { public function new() {