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