make SceneFlxStates SubStates

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

View File

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

View File

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

View File

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