From dd60bddb462edd618f7f8a6e1b8a251ece72b66b Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Tue, 14 Dec 2021 20:48:53 -0700 Subject: [PATCH] buggy label/skip system for hollywooFlixel --- src/hollywoo_flixel/FlxDirector.kiss | 1 + src/hollywoo_flixel/HollywooFlixelDSL.kiss | 13 ++++++++++++- src/hollywoo_flixel/MovieFlxState.hx | 1 + src/hollywoo_flixel/SceneFlxState.hx | 1 + src/hollywoo_flixel/SceneFlxState.kiss | 3 +++ 5 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/hollywoo_flixel/FlxDirector.kiss b/src/hollywoo_flixel/FlxDirector.kiss index 95d35ee..e661cf6 100644 --- a/src/hollywoo_flixel/FlxDirector.kiss +++ b/src/hollywoo_flixel/FlxDirector.kiss @@ -18,6 +18,7 @@ (currentState.close)) // TODO on the first appearance, give a super (for some scenes but probably not others... hm....) (set currentState (cast scene SceneFlxState)) + (set currentState.parent FlxG.state) (FlxG.state.openSubState currentState) (cc)) diff --git a/src/hollywoo_flixel/HollywooFlixelDSL.kiss b/src/hollywoo_flixel/HollywooFlixelDSL.kiss index b397196..ea98f40 100644 --- a/src/hollywoo_flixel/HollywooFlixelDSL.kiss +++ b/src/hollywoo_flixel/HollywooFlixelDSL.kiss @@ -20,4 +20,15 @@ (method newFlxProp [name path] (let [propSprite (new FlxSprite 0 0)] (propSprite.loadGraphic path) - (newProp name propSprite))) \ No newline at end of file + (newProp name propSprite))) + +(method :Void update [:Float elapsed] + // TODO CCs queued to timers will still be called + (#when debug + (when FlxG.keys.justPressed.N + (doFor [idx label] (enumerate labels) + (when (> label lastInstructionPointer) + (doFor =>labelName labelIdx labelsByName + (when (= labelIdx label) (trace "SKIPPING TO $labelName"))) + (runInstruction label) + (break)))))) \ No newline at end of file diff --git a/src/hollywoo_flixel/MovieFlxState.hx b/src/hollywoo_flixel/MovieFlxState.hx index cacaaab..e049e72 100644 --- a/src/hollywoo_flixel/MovieFlxState.hx +++ b/src/hollywoo_flixel/MovieFlxState.hx @@ -1,6 +1,7 @@ package hollywoo_flixel; import flixel.FlxState; +import kiss.Prelude; @:build(kiss.Kiss.build()) class MovieFlxState extends FlxState {} diff --git a/src/hollywoo_flixel/SceneFlxState.hx b/src/hollywoo_flixel/SceneFlxState.hx index df5864c..d7e3e95 100644 --- a/src/hollywoo_flixel/SceneFlxState.hx +++ b/src/hollywoo_flixel/SceneFlxState.hx @@ -3,6 +3,7 @@ package hollywoo_flixel; import kiss.Prelude; import kiss.List; import flixel.FlxSubState; +import flixel.FlxState; import flixel.FlxSprite; import flixel.FlxG; import hollywoo.Scene; diff --git a/src/hollywoo_flixel/SceneFlxState.kiss b/src/hollywoo_flixel/SceneFlxState.kiss index 4345cfd..b5b35f9 100644 --- a/src/hollywoo_flixel/SceneFlxState.kiss +++ b/src/hollywoo_flixel/SceneFlxState.kiss @@ -1,5 +1,6 @@ (defNew [&prop :FlxSprite setSprite &prop :SceneTime time &prop :ScenePerspective perspective] [ + &mut :FlxState parent null :Map> characters (new Map) :Map propsOnScreen (new Map) ] @@ -15,4 +16,6 @@ (setSprite.screenCenter)) (method &override :Void update [:Float elapsed] + (when parent + (parent.update elapsed)) (super.update elapsed)) \ No newline at end of file