fix hollywoo set sprites loading on the fly
This commit is contained in:
@@ -10,9 +10,11 @@
|
|||||||
(FlxG.inputs.add actionManager)
|
(FlxG.inputs.add actionManager)
|
||||||
(set actionManager.resetOnStateSwitch NONE))
|
(set actionManager.resetOnStateSwitch NONE))
|
||||||
|
|
||||||
|
(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]
|
||||||
// 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....)
|
||||||
(FlxG.switchState (cast scene SceneFlxState))
|
(set currentState (cast scene SceneFlxState))
|
||||||
|
(FlxG.switchState currentState)
|
||||||
(cc))
|
(cc))
|
||||||
|
|
||||||
(var STAGE_LEFT_X 150)
|
(var STAGE_LEFT_X 150)
|
||||||
@@ -33,7 +35,7 @@
|
|||||||
STAGE_RIGHT_X))
|
STAGE_RIGHT_X))
|
||||||
(/ character.actor.width 2)))
|
(/ character.actor.width 2)))
|
||||||
(set character.actor.y ACTOR_Y)
|
(set character.actor.y ACTOR_Y)
|
||||||
(FlxG.state.add character.actor)
|
(currentState.add character.actor)
|
||||||
(cc))
|
(cc))
|
||||||
|
|
||||||
(prop &mut :Null<Continuation> nextCC)
|
(prop &mut :Null<Continuation> nextCC)
|
||||||
@@ -72,18 +74,18 @@
|
|||||||
(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)
|
||||||
(FlxG.state.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))
|
||||||
(FlxG.state.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
|
||||||
(set speakerNameText (new FlxText DIALOG_X DIALOG_Y DIALOG_WIDTH "" DIALOG_SIZE))
|
(set speakerNameText (new FlxText DIALOG_X DIALOG_Y DIALOG_WIDTH "" DIALOG_SIZE))
|
||||||
(FlxG.state.add speakerNameText))
|
(currentState.add speakerNameText))
|
||||||
(if speakerName
|
(if speakerName
|
||||||
{
|
{
|
||||||
(set speakerNameText.text "${speakerName}:")
|
(set speakerNameText.text "${speakerName}:")
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
(loadFrom "hollywoo" "src/hollywoo/HollywooDSL.kiss")
|
(loadFrom "hollywoo" "src/hollywoo/HollywooDSL.kiss")
|
||||||
|
|
||||||
|
(method newFlxScene [name set time perspective]
|
||||||
|
(let [setSprite (new FlxSprite 0 0)]
|
||||||
|
(setSprite.loadGraphic (dictGet sets set))
|
||||||
|
(newScene name (cast (new SceneFlxState setSprite time perspective)))))
|
||||||
|
|
||||||
(method newFlxSound [name path &opt :Float volume]
|
(method newFlxSound [name path &opt :Float volume]
|
||||||
(set volume (or volume 1))
|
(set volume (or volume 1))
|
||||||
(assert (<= 0 volume 1))
|
(assert (<= 0 volume 1))
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
(defNew [&prop :String set &prop :SceneTime time &prop :ScenePerspective perspective]
|
(defNew [&prop :FlxSprite setSprite &prop :SceneTime time &prop :ScenePerspective perspective]
|
||||||
[
|
[
|
||||||
:Map<String,Character<FlxStagePosition,FlxStageFacing,ActorFlxSprite>> characters (new Map)
|
:Map<String,Character<FlxStagePosition,FlxStageFacing,ActorFlxSprite>> characters (new Map)
|
||||||
]
|
]
|
||||||
(super))
|
(super)
|
||||||
|
(add setSprite))
|
||||||
|
|
||||||
(method &override :Void create []
|
(method &override :Void create []
|
||||||
(super.create)
|
(super.create)
|
||||||
(let [setSprite (new FlxSprite 0 0)]
|
|
||||||
(setSprite.loadGraphic set)
|
|
||||||
(when (> setSprite.width FlxG.width)
|
(when (> setSprite.width FlxG.width)
|
||||||
(setSprite.setGraphicSize FlxG.width))
|
(setSprite.setGraphicSize FlxG.width))
|
||||||
(when (> setSprite.height FlxG.height)
|
(when (> setSprite.height FlxG.height)
|
||||||
(setSprite.setGraphicSize 0 FlxG.height))
|
(setSprite.setGraphicSize 0 FlxG.height))
|
||||||
(setSprite.screenCenter)
|
(setSprite.screenCenter))
|
||||||
(add setSprite)))
|
|
||||||
|
|
||||||
(method &override :Void update [:Float elapsed]
|
(method &override :Void update [:Float elapsed]
|
||||||
(super.update elapsed))
|
(super.update elapsed))
|
||||||
Reference in New Issue
Block a user