mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-16 00:19:50 -05:00
Set up wizard sprites to use the color config.
This commit is contained in:
parent
c4028a8036
commit
de258fdf20
4 changed files with 12 additions and 4 deletions
|
@ -72,7 +72,10 @@ module.exports = class LevelLoader extends CocoClass
|
|||
@notifyProgress()
|
||||
if e.model.type() is 'ThangType'
|
||||
thangType = e.model
|
||||
building = thangType.buildSpriteSheet {async: true}
|
||||
options = {async: true}
|
||||
if thangType.get('name') is 'Wizard'
|
||||
options.colorConfig = me.get('wizard')?.colorConfig or {}
|
||||
building = thangType.buildSpriteSheet options
|
||||
if building
|
||||
@spriteSheetsToBuild += 1
|
||||
thangType.on 'build-complete', =>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
CocoClass = require 'lib/CocoClass'
|
||||
SpriteBuilder = require 'lib/sprites/SpriteBuilder'
|
||||
{createProgressBar} = require './sprite_utils'
|
||||
Camera = require './Camera'
|
||||
Mark = require './Mark'
|
||||
|
|
|
@ -26,6 +26,8 @@ module.exports = class WizardSprite extends IndieSprite
|
|||
'echo-all-wizard-sprites': 'onEchoAllWizardSprites'
|
||||
|
||||
constructor: (thangType, options) ->
|
||||
if options?.isSelf
|
||||
options.colorConfig = me.get('wizard')?.colorConfig or {}
|
||||
super thangType, options
|
||||
@isSelf = options.isSelf
|
||||
@targetPos = @thang.pos
|
||||
|
|
|
@ -56,7 +56,7 @@ module.exports = class ThangType extends CocoModel
|
|||
initBuild: (options) ->
|
||||
@buildActions() if not @actions
|
||||
@options = @fillOptions options
|
||||
@vectorParser = new SpriteBuilder(@)
|
||||
@vectorParser = new SpriteBuilder(@, options)
|
||||
@builder = new createjs.SpriteSheetBuilder()
|
||||
@builder.padding = 2
|
||||
@frames = {}
|
||||
|
@ -142,7 +142,11 @@ module.exports = class ThangType extends CocoModel
|
|||
@trigger 'build-complete'
|
||||
|
||||
spriteSheetKey: (options) ->
|
||||
"#{@get('name')} - #{options.resolutionFactor}"
|
||||
colorConfigs = []
|
||||
for groupName, config of options.colorConfig or {}
|
||||
colorConfigs.push "#{groupName}:#{config.hue}|#{config.saturation}|#{config.lightness}"
|
||||
colorConfigs = colorConfigs.join ','
|
||||
"#{@get('name')} - #{options.resolutionFactor} - #{colorConfigs}"
|
||||
|
||||
getPortraitImage: (spriteOptionsOrKey, size=100) ->
|
||||
src = @getPortraitSource(spriteOptionsOrKey, size)
|
||||
|
|
Loading…
Reference in a new issue