Got lanks to update healthbars when the floating layer spritesheet is recreated.

This commit is contained in:
Scott Erickson 2014-11-19 16:09:20 -08:00
parent 716f8864f1
commit 09087428b9

View file

@ -491,6 +491,7 @@ module.exports = Lank = class Lank extends CocoClass
bar = createProgressBar(healthColor)
@options.floatingLayer.addCustomGraphic(key, bar, bar.bounds)
hadHealthBar = @healthBar
@healthBar = new createjs.Sprite(@options.floatingLayer.spriteSheet)
@healthBar.gotoAndStop(key)
offset = @getOffset 'aboveHead'
@ -499,6 +500,8 @@ module.exports = Lank = class Lank extends CocoClass
@options.floatingLayer.addChild @healthBar
@updateHealthBar()
@lastHealth = null
if not hadHealthBar
@listenTo @options.floatingLayer, 'new-spritesheet', @addHealthBar
getActionProp: (prop, subProp, def=null) ->
# Get a property or sub-property from an action, falling back to ThangType