36 lines
1.5 KiB
Plaintext
36 lines
1.5 KiB
Plaintext
// Track which actors are in FRONT of the stage so actors can appear behind them
|
|
(prop &mut :ActorFlxSprite actorOnLeft null)
|
|
(prop &mut :Character<FlxStagePosition,FlxStageFacing,ActorFlxSprite> characterOnLeft null)
|
|
(prop &mut :ActorFlxSprite actorOnRight null)
|
|
(prop &mut :Character<FlxStagePosition,FlxStageFacing,ActorFlxSprite> characterOnRight null)
|
|
|
|
// Track props in an arbitrary number of layers
|
|
(prop :Array<FlxTypedGroup<FlxSprite>> spriteLayers [])
|
|
(var LAYER_MAX 5)
|
|
|
|
(defNew [&prop :FlxSprite setSprite &prop :SceneTime time &prop :ScenePerspective perspective]
|
|
[
|
|
&mut :FlxState parent null
|
|
:FuzzyMap<Character<FlxStagePosition,FlxStageFacing,ActorFlxSprite>> characters (new FuzzyMap<Character<FlxStagePosition,FlxStageFacing,ActorFlxSprite>>)
|
|
:Map<FlxSprite,FlxScreenPosition> propsOnScreen (new Map)
|
|
]
|
|
(super)
|
|
(add setSprite)
|
|
// TODO characters will be in front of every prop layer -- characters need their own group layer
|
|
(doFor i (range LAYER_MAX)
|
|
(let [g (new FlxTypedGroup<FlxSprite>)]
|
|
(spriteLayers.push g)
|
|
(add g))))
|
|
|
|
(method &override :Void create []
|
|
(super.create)
|
|
(setSprite.setGraphicSize FlxG.width)
|
|
(when (> setSprite.height FlxG.height)
|
|
(setSprite.setGraphicSize 0 FlxG.height))
|
|
(setSprite.updateHitbox)
|
|
(setSprite.screenCenter))
|
|
|
|
(method &override :Void update [:Float elapsed]
|
|
(when parent
|
|
(parent.update elapsed))
|
|
(super.update elapsed)) |