diff --git a/app/lib/surface/CocoSprite.coffee b/app/lib/surface/CocoSprite.coffee index c76959036..3ff14ac4d 100644 --- a/app/lib/surface/CocoSprite.coffee +++ b/app/lib/surface/CocoSprite.coffee @@ -131,6 +131,8 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass playAction: (action) -> @currentAction = action + return @hide() unless action.animation or action.container or action.relatedActions + @show() return @updateActionDirection() unless action.animation or action.container m = if action.container then "gotoAndStop" else "gotoAndPlay" @imageObject[m] action.name @@ -142,6 +144,14 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass start = Math.floor(Math.random() * action.frames.length) @imageObject.currentAnimationFrame = start + hide: -> + @hiding = true + @updateAlpha() + + show: -> + @hiding = false + @updateAlpha() + update: -> # Gets the sprite to reflect what the current state of the thangs and surface are return if @stillLoading @@ -191,6 +201,7 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass @imageObject.scaleY = @originalScaleY * scaleY * scaleFactor updateAlpha: -> + @imageObject.alpha = if @hiding then 0 else 1 return unless @thang?.alpha? @imageObject.alpha = @thang.alpha if @options.showInvisible