make SceneFlxStates SubStates

This commit is contained in:
2021-11-02 20:02:20 -04:00
parent c6275716a1
commit db4dfa3320
3 changed files with 11 additions and 7 deletions

View File

@@ -13,9 +13,12 @@
(prop &mut :SceneFlxState currentState)
(method :Void showScene [:Scene<String,FlxStagePosition,FlxStageFacing,FlxScreenPosition,ActorFlxSprite> scene :Appearance appearance :Continuation cc]
// Close the last scene state
(when currentState
(currentState.close))
// TODO on the first appearance, give a super (for some scenes but probably not others... hm....)
(set currentState (cast scene SceneFlxState))
(FlxG.switchState currentState)
(FlxG.state.openSubState currentState)
(cc))
(var STAGE_LEFT_X 150)
@@ -70,14 +73,14 @@
// Make a dialog box
(unless dialogBox
(set dialogBox (new FlxSprite DIALOG_X DIALOG_Y))
(dialogBox.makeGraphic DIALOG_WIDTH DIALOG_HEIGHT DIALOG_BOX_COLOR)
(currentState.add dialogBox))
(dialogBox.makeGraphic DIALOG_WIDTH DIALOG_HEIGHT DIALOG_BOX_COLOR))
(currentState.add dialogBox)
(dialogBox.revive)
// show the dialog
(unless dialogText
// TODO use FlxTypeText to reveal dialog gradually
(set dialogText (new FlxText DIALOG_X DIALOG_Y DIALOG_WIDTH "" DIALOG_SIZE))
(currentState.add dialogText))
(set dialogText (new FlxText DIALOG_X DIALOG_Y DIALOG_WIDTH "" DIALOG_SIZE)))
(currentState.add dialogText)
(set dialogText.text text)
// show the speaker name
(unless speakerNameText

View File

@@ -2,6 +2,7 @@
(prop &mut :FlxMovie movie)
(method &override :Void create []
(set destroySubStates false)
(super.create)
(set director (new FlxDirector))
(set movie (new FlxMovie director)))

View File

@@ -2,11 +2,11 @@ package hollywoo_flixel;
import kiss.Prelude;
import kiss.List;
import flixel.FlxState;
import flixel.FlxSubState;
import flixel.FlxSprite;
import flixel.FlxG;
import hollywoo.Scene;
import hollywoo_flixel.FlxMovie;
@:build(kiss.Kiss.build())
class SceneFlxState extends FlxState {}
class SceneFlxState extends FlxSubState {}