mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-30 10:56:53 -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) ->
|
onZoomUpdated: (e) ->
|
||||||
return unless e.camera is @camera
|
return unless e.camera is @camera
|
||||||
# TODO: move this to the new SpriteStage, because it's what needs to be transformed.
|
if @transformStyle in [layerClassProperties.TRANSFORM_SURFACE, layerClassProperties.TRANSFORM_SURFACE_TEXT, layerClassProperties.TRANSFORM_CHILD]
|
||||||
# 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]
|
|
||||||
change = @scaleX / e.zoom
|
change = @scaleX / e.zoom
|
||||||
@scaleX = @scaleY = e.zoom
|
@scaleX = @scaleY = e.zoom
|
||||||
@regX = e.surfaceViewport.x
|
@regX = e.surfaceViewport.x
|
||||||
|
|
|
@ -45,7 +45,7 @@ describe 'SpriteBoss', ->
|
||||||
thangTypes = [treeThangType, ogreMunchkinThangType, ogreFangriderThangType, fullRenderOgreMunchkinThangType, fullRenderTreeThangType]
|
thangTypes = [treeThangType, ogreMunchkinThangType, ogreFangriderThangType, fullRenderOgreMunchkinThangType, fullRenderTreeThangType]
|
||||||
|
|
||||||
# Build the Stage and SpriteBoss.
|
# Build the Stage and SpriteBoss.
|
||||||
window.stage = stage = new createjs.Stage(canvas[0])
|
window.stage = stage = new createjs.SpriteStage(canvas[0])
|
||||||
options = {
|
options = {
|
||||||
camera: camera
|
camera: camera
|
||||||
surfaceLayer: stage
|
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 }
|
{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
|
# 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 }
|
{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
|
# A line of ogres overlapping to test child ordering
|
||||||
|
@ -94,8 +94,7 @@ describe 'SpriteBoss', ->
|
||||||
spriteBoss.update(true)
|
spriteBoss.update(true)
|
||||||
defaultLayer.once 'new-spritesheet', ->
|
defaultLayer.once 'new-spritesheet', ->
|
||||||
done()
|
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)
|
beforeEach (done) -> init(done)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue