put character sprites in layers
This commit is contained in:
@@ -251,16 +251,24 @@
|
|||||||
(/ character.actor.width 2)))
|
(/ character.actor.width 2)))
|
||||||
(set character.actor.y character.stagePosition.y)
|
(set character.actor.y character.stagePosition.y)
|
||||||
// Bump sprites up from the bottom if they're too tall
|
// Bump sprites up from the bottom if they're too tall
|
||||||
(let [bottom (+ character.actor.y character.actor.height)]
|
(cond
|
||||||
(when (> bottom FlxG.height)
|
((flxMovie.presetPositions.exists (character.stagePosition.stringify))
|
||||||
(-= character.actor.y (- bottom FlxG.height))))
|
(let [bottom (+ character.actor.y character.actor.height)]
|
||||||
// Display with y adjusted by z:
|
(when (> bottom FlxG.height)
|
||||||
(-= character.actor.y character.stagePosition.z)
|
(-= character.actor.y (- bottom FlxG.height))))
|
||||||
(FlxG.state.add character.actor)
|
// Display with y adjusted by z:
|
||||||
|
(-= character.actor.y character.stagePosition.z)
|
||||||
|
(let [layer (- LAYER_MAX (% character.stagePosition.z flxMovie.STAGE_BEHIND_DY))]
|
||||||
|
(.add (nth spriteLayers layer) character.actor)))
|
||||||
|
(true
|
||||||
|
(.add (nth spriteLayers (Std.int character.stagePosition.z)) character.actor)))
|
||||||
|
|
||||||
(cc))
|
(cc))
|
||||||
|
|
||||||
(method :Void hideCharacter [:Character<ActorFlxSprite> character :FlxCamera camera :Continuation cc]
|
(method :Void hideCharacter [:Character<ActorFlxSprite> character :FlxCamera camera :Continuation cc]
|
||||||
(FlxG.state.remove character.actor)
|
(FlxG.state.remove character.actor)
|
||||||
|
(doFor layer spriteLayers
|
||||||
|
(layer.remove character.actor))
|
||||||
(cc))
|
(cc))
|
||||||
|
|
||||||
(prop &mut :Null<Continuation> nextCC)
|
(prop &mut :Null<Continuation> nextCC)
|
||||||
|
Reference in New Issue
Block a user