mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-07 10:34:46 -04:00
Added a global SPRITE_RESOLUTION_FACTOR property.
This commit is contained in:
parent
65aae86dcc
commit
eebbae9b13
5 changed files with 10 additions and 6 deletions
|
@ -8,6 +8,9 @@ CocoView = require 'views/kinds/CocoView'
|
|||
|
||||
marked.setOptions {gfm: true, sanitize: true, smartLists: true, breaks: false}
|
||||
|
||||
# TODO, add C-style macro constants like this?
|
||||
window.SPRITE_RESOLUTION_FACTOR = 4
|
||||
|
||||
# Prevent Ctrl/Cmd + [ / ], P, S
|
||||
ctrlDefaultPrevented = [219, 221, 80, 83]
|
||||
preventBackspace = (event) ->
|
||||
|
|
|
@ -201,7 +201,7 @@ module.exports = class LevelLoader extends CocoClass
|
|||
# queue.loadFile('/file/'+f)
|
||||
@grabThangTypeTeams() unless @thangTypeTeams
|
||||
for team in @thangTypeTeams[thangType.get('original')] ? [null]
|
||||
spriteOptions = {resolutionFactor: 4, async: false}
|
||||
spriteOptions = {resolutionFactor: SPRITE_RESOLUTION_FACTOR, async: false}
|
||||
if thangType.get('kind') is 'Floor'
|
||||
spriteOptions.resolutionFactor = 2
|
||||
if team and color = @teamConfigs[team]?.color
|
||||
|
|
|
@ -24,7 +24,7 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
|
|||
ranges: null
|
||||
|
||||
options:
|
||||
resolutionFactor: 4
|
||||
resolutionFactor: SPRITE_RESOLUTION_FACTOR
|
||||
groundLayer: null
|
||||
textLayer: null
|
||||
floatingLayer: null
|
||||
|
|
|
@ -150,7 +150,7 @@ module.exports = class SpriteBoss extends CocoClass
|
|||
thangType ?= _.find @options.thangTypes, (m) -> return m.get('name') is thang.spriteName
|
||||
|
||||
options = @createSpriteOptions thang: thang
|
||||
options.resolutionFactor = if thangType.get('kind') is 'Floor' then 2 else 4
|
||||
options.resolutionFactor = if thangType.get('kind') is 'Floor' then 2 else SPRITE_RESOLUTION_FACTOR
|
||||
sprite = new CocoSprite thangType, options
|
||||
@addSprite sprite, null, layer
|
||||
sprite.setDebug @debug
|
||||
|
@ -213,8 +213,9 @@ module.exports = class SpriteBoss extends CocoClass
|
|||
@spriteLayers["Obstacle"].uncache() if @spriteLayers["Obstacle"].cacheID # might have changed sizes
|
||||
@spriteLayers["Obstacle"].cache()
|
||||
# test performance of doing land layer, too, to see if it's faster
|
||||
#@spriteLayers["Land"].uncache() if @spriteLayers["Land"].cacheID # might have changed sizes
|
||||
#@spriteLayers["Land"].cache()
|
||||
# @spriteLayers["Land"].uncache() if @spriteLayers["Land"].cacheID # might have changed sizes
|
||||
# @spriteLayers["Land"].cache()
|
||||
# I don't notice much difference - Scott
|
||||
@cached = true
|
||||
|
||||
spriteFor: (thangID) -> @sprites[thangID]
|
||||
|
|
|
@ -53,7 +53,7 @@ module.exports = class ThangType extends CocoModel
|
|||
fillOptions: (options) ->
|
||||
options ?= {}
|
||||
options = _.clone options
|
||||
options.resolutionFactor ?= 4
|
||||
options.resolutionFactor ?= SPRITE_RESOLUTION_FACTOR
|
||||
options.async ?= false
|
||||
options
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue