Actions without a container or animation to show don't show anything.

This commit is contained in:
Scott Erickson 2014-02-05 14:57:05 -08:00
parent 88beb4db5f
commit f900009770

View file

@ -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