mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-28 01:55:38 -05:00
Actions without a container or animation to show don't show anything.
This commit is contained in:
parent
88beb4db5f
commit
f900009770
1 changed files with 11 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue