Fixed some bugs with sprite sound loading and playback.

This commit is contained in:
Nick Winter 2014-05-15 20:49:10 -07:00
parent 65aae86dcc
commit ca6ea474bf
2 changed files with 12 additions and 10 deletions

View file

@ -80,6 +80,8 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
@listenToOnce(@thangType, 'sync', @setupSprite) @listenToOnce(@thangType, 'sync', @setupSprite)
setupSprite: -> setupSprite: ->
for trigger, sounds of @thangType.get('soundTriggers') or {} when trigger isnt 'say'
AudioPlayer.preloadSoundReference sound for sound in sounds
@stillLoading = false @stillLoading = false
if @thangType.get('raster') if @thangType.get('raster')
@isRaster = true @isRaster = true

View file

@ -272,7 +272,7 @@ module.exports = class SpriteBoss extends CocoClass
@selectedSprite?.selected = false @selectedSprite?.selected = false
sprite?.selected = true sprite?.selected = true
@selectedSprite = sprite @selectedSprite = sprite
alive = sprite?.thang.health > 0 alive = not (sprite?.thang.health < 0)
Backbone.Mediator.publish 'surface:sprite-selected', Backbone.Mediator.publish 'surface:sprite-selected',
thang: if sprite then sprite.thang else null thang: if sprite then sprite.thang else null