From 8921f231bd9fdc41df5072165bbeb5d8277d710e Mon Sep 17 00:00:00 2001 From: 3wc <3wc@doesthisthing.work> Date: Wed, 14 Feb 2024 14:25:04 -0300 Subject: [PATCH] Fix crash when jumping straight to WorldMapScene --- src/DialogueBox.hx | 2 +- src/Game.hx | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/DialogueBox.hx b/src/DialogueBox.hx index c9299de..e0a40bb 100644 --- a/src/DialogueBox.hx +++ b/src/DialogueBox.hx @@ -17,7 +17,7 @@ class DialogueBox extends h2d.Object { if (text == null) text = "NULL"; 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.colorKey = 0xFF00FF; tf = new h2d.Text(game.font, this); diff --git a/src/Game.hx b/src/Game.hx index 799ac27..51f3f63 100644 --- a/src/Game.hx +++ b/src/Game.hx @@ -63,12 +63,6 @@ class Game extends hxd.App { globalEventBus = new EventBus(console); globalEventBus.subscribe(ChangeSceneEvent, onChangeScene); - #if debug - setGameScene(new WorldMapScene(root)); - #else - setGameScene(new TitleScene(root)); - #end - font = Res.font.minecraftia_regular_6.toFont(); font.resizeTo(24); @@ -81,6 +75,12 @@ class Game extends hxd.App { hxd.Res.text.intro.entry.name, ]; dialogueManager.load(yarnText, yarnFileNames); + + #if debug + setGameScene(new WorldMapScene(root)); + #else + setGameScene(new TitleScene(root)); + #end } public function new() {