mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 09:35:39 -05:00
Had apparently switched the SpriteBoss tests to use a regular Stage instead of a SpriteStage. Switched it back, and fixed a subsequent bug with the Layer responding to Camera events (apparently SpriteStage does not take regX/Y or scaleX/Y into account).
This commit is contained in:
parent
f2765e05b0
commit
b1784a1207
2 changed files with 4 additions and 12 deletions
|
@ -74,14 +74,7 @@ layerProperties = {
|
|||
|
||||
onZoomUpdated: (e) ->
|
||||
return unless e.camera is @camera
|
||||
# TODO: move this to the new SpriteStage, because it's what needs to be transformed.
|
||||
# This is a bit of a hack to get it to work for the time being.
|
||||
if @parent and @transformStyle is layerClassProperties.TRANSFORM_CHILD
|
||||
@parent.scaleX = @parent.scaleY = e.zoom
|
||||
@parent.regX = e.surfaceViewport.x
|
||||
@parent.regY = e.surfaceViewport.y
|
||||
|
||||
if @transformStyle in [layerClassProperties.TRANSFORM_SURFACE, layerClassProperties.TRANSFORM_SURFACE_TEXT]
|
||||
if @transformStyle in [layerClassProperties.TRANSFORM_SURFACE, layerClassProperties.TRANSFORM_SURFACE_TEXT, layerClassProperties.TRANSFORM_CHILD]
|
||||
change = @scaleX / e.zoom
|
||||
@scaleX = @scaleY = e.zoom
|
||||
@regX = e.surfaceViewport.x
|
||||
|
|
|
@ -45,7 +45,7 @@ describe 'SpriteBoss', ->
|
|||
thangTypes = [treeThangType, ogreMunchkinThangType, ogreFangriderThangType, fullRenderOgreMunchkinThangType, fullRenderTreeThangType]
|
||||
|
||||
# Build the Stage and SpriteBoss.
|
||||
window.stage = stage = new createjs.Stage(canvas[0])
|
||||
window.stage = stage = new createjs.SpriteStage(canvas[0])
|
||||
options = {
|
||||
camera: camera
|
||||
surfaceLayer: stage
|
||||
|
@ -76,7 +76,7 @@ describe 'SpriteBoss', ->
|
|||
{id: 'Ogre S', spriteName: 'Ogre Munchkin M', exists: true, pos: {x:0, y:-8}, action: 'move', health: 5, maxHealth: 10, rotation: Math.PI/2, acts: true }
|
||||
|
||||
# Set ogres side by side with different render strategies
|
||||
{id: 'FROgre', spriteName: 'Full Render Ogre', exists: true, pos: {x:-10, y:-8}, action: 'idle', health: 10, maxHealth: 10, rotation: 0, acts: true }
|
||||
{id: 'FROgre', spriteName: 'Full Render Ogre', exists: true, pos: {x:-10, y:-8}, action: 'idle', health: 10, maxHealth: 10, rotation: 0, acts: true, alpha: 0.5 }
|
||||
{id: 'NotFROgre', spriteName: 'Ogre Munchkin M', exists: true, pos: {x:-8, y:-8}, action: 'idle', health: 10, maxHealth: 10, rotation: 0, acts: true }
|
||||
|
||||
# A line of ogres overlapping to test child ordering
|
||||
|
@ -94,8 +94,7 @@ describe 'SpriteBoss', ->
|
|||
spriteBoss.update(true)
|
||||
defaultLayer.once 'new-spritesheet', ->
|
||||
done()
|
||||
|
||||
showMe() # Uncomment to display this world when you run any of these tests.
|
||||
# showMe() # Uncomment to display this world when you run any of these tests.
|
||||
|
||||
beforeEach (done) -> init(done)
|
||||
|
||||
|
|
Loading…
Reference in a new issue