mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Fixed sprite coloring and the thangtype-not-yet-loaded placeholder.
This commit is contained in:
parent
6f45eee81d
commit
c1e7423a64
2 changed files with 9 additions and 2 deletions
|
@ -61,6 +61,9 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
|
|||
super()
|
||||
@options = _.extend($.extend(true, {}, @options), options)
|
||||
@setThang @options.thang
|
||||
if @thang?
|
||||
options = @thang?.getSpriteOptions?()
|
||||
@options.colorConfig = options.colorConfig if options.colorConfig
|
||||
console.error @toString(), 'has no ThangType!' unless @thangType
|
||||
|
||||
# this is a stub, use @setImageObject to swap it out for something else later
|
||||
|
@ -138,6 +141,7 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
|
|||
return @hide() unless action.animation or action.container or action.relatedActions
|
||||
@show()
|
||||
return @updateActionDirection() unless action.animation or action.container
|
||||
return if @imageObject.placeholder
|
||||
m = if action.container then 'gotoAndStop' else 'gotoAndPlay'
|
||||
@imageObject[m]?(action.name)
|
||||
@updateScale()
|
||||
|
|
|
@ -441,8 +441,11 @@ module.exports = LayerAdapter = class LayerAdapter extends CocoClass
|
|||
if not cocoSprite.thangType.isFullyLoaded()
|
||||
# just give a placeholder
|
||||
sprite = new createjs.Sprite(@spriteSheet)
|
||||
sprite.gotoAndStop(0)
|
||||
sprite.placeholder = true
|
||||
sprite.baseScaleX = sprite.baseScaleY = 1
|
||||
sprite.regX = @resolutionFactor * SPRITE_PLACEHOLDER_WIDTH / 2
|
||||
sprite.regY = @resolutionFactor * SPRITE_PLACEHOLDER_WIDTH
|
||||
sprite.baseScaleX = sprite.baseScaleY = sprite.scaleX = sprite.scaleY = 10 / (@resolutionFactor * SPRITE_PLACEHOLDER_WIDTH)
|
||||
|
||||
else if cocoSprite.thangType.get('raster')
|
||||
sprite = new createjs.Sprite(@spriteSheet)
|
||||
|
@ -455,7 +458,7 @@ module.exports = LayerAdapter = class LayerAdapter extends CocoClass
|
|||
|
||||
else
|
||||
SpriteClass = if (cocoSprite.thangType.get('spriteType') or @defaultSpriteType) is 'segmented' then SegmentedSprite else SingularSprite
|
||||
prefix = @renderGroupingKey(cocoSprite.thangType, null, cocoSprite.colorConfig) + '.'
|
||||
prefix = @renderGroupingKey(cocoSprite.thangType, null, cocoSprite.options.colorConfig) + '.'
|
||||
sprite = new SpriteClass(@spriteSheet, cocoSprite.thangType, prefix, @resolutionFactor)
|
||||
|
||||
sprite.sprite = cocoSprite
|
||||
|
|
Loading…
Reference in a new issue