mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-28 01:55:38 -05:00
Fixed bobbing. Increased LayerAdapter cleanup vengeancy. Allow dragging without snapping when playback is at the end.
This commit is contained in:
parent
0fefd627fa
commit
b286b24f27
3 changed files with 7 additions and 5 deletions
|
@ -171,8 +171,9 @@ module.exports = Lank = class Lank extends CocoClass
|
||||||
update: (frameChanged) ->
|
update: (frameChanged) ->
|
||||||
# Gets the sprite to reflect what the current state of the thangs and surface are
|
# Gets the sprite to reflect what the current state of the thangs and surface are
|
||||||
return false if @stillLoading
|
return false if @stillLoading
|
||||||
|
if (frameChanged and @thang and @thang.stateChanged) or (@thang and @thang.bobHeight) or @notOfThisWorld
|
||||||
|
@updatePosition()
|
||||||
return false if @thang and @thang.stateChanged is false
|
return false if @thang and @thang.stateChanged is false
|
||||||
@updatePosition() if frameChanged or @thang.bobHeight or @notOfThisWorld
|
|
||||||
frameChanged = frameChanged or @targetScaleFactorX isnt @scaleFactorX or @targetScaleFactorY isnt @scaleFactorY
|
frameChanged = frameChanged or @targetScaleFactorX isnt @scaleFactorX or @targetScaleFactorY isnt @scaleFactorY
|
||||||
if frameChanged
|
if frameChanged
|
||||||
@handledDisplayEvents = {}
|
@handledDisplayEvents = {}
|
||||||
|
@ -198,7 +199,7 @@ module.exports = Lank = class Lank extends CocoClass
|
||||||
@handledDisplayEvents[event] = true
|
@handledDisplayEvents[event] = true
|
||||||
args = JSON.parse(event[4...])
|
args = JSON.parse(event[4...])
|
||||||
key = 'aoe-' + JSON.stringify(args[2..])
|
key = 'aoe-' + JSON.stringify(args[2..])
|
||||||
|
|
||||||
unless key in @options.groundLayer.spriteSheet.getAnimations()
|
unless key in @options.groundLayer.spriteSheet.getAnimations()
|
||||||
args = JSON.parse(event[4...])
|
args = JSON.parse(event[4...])
|
||||||
circle = new createjs.Shape()
|
circle = new createjs.Shape()
|
||||||
|
@ -401,7 +402,7 @@ module.exports = Lank = class Lank extends CocoClass
|
||||||
# wallGrid is only needed for wall grid face updates; should refactor if this works
|
# wallGrid is only needed for wall grid face updates; should refactor if this works
|
||||||
return unless action = @getActionDirection()
|
return unless action = @getActionDirection()
|
||||||
@playAction(action) if action isnt @currentAction
|
@playAction(action) if action isnt @currentAction
|
||||||
|
|
||||||
lockAction: -> (@actionLocked=true)
|
lockAction: -> (@actionLocked=true)
|
||||||
|
|
||||||
getActionDirection: (rootAction=null) ->
|
getActionDirection: (rootAction=null) ->
|
||||||
|
|
|
@ -47,6 +47,7 @@ module.exports = class LankBoss extends CocoClass
|
||||||
@removeLank lank for thangID, lank of @lanks
|
@removeLank lank for thangID, lank of @lanks
|
||||||
@targetMark?.destroy()
|
@targetMark?.destroy()
|
||||||
@selectionMark?.destroy()
|
@selectionMark?.destroy()
|
||||||
|
lankLayer.destroy() for lankLayer in _.values @layerAdapters
|
||||||
super()
|
super()
|
||||||
|
|
||||||
toString: -> "<LankBoss: #{@lankArray.length} lanks>"
|
toString: -> "<LankBoss: #{@lankArray.length} lanks>"
|
||||||
|
@ -248,7 +249,7 @@ module.exports = class LankBoss extends CocoClass
|
||||||
wallLank.updatePosition()
|
wallLank.updatePosition()
|
||||||
# console.log wallGrid.toString()
|
# console.log wallGrid.toString()
|
||||||
@cachedObstacles = true
|
@cachedObstacles = true
|
||||||
|
|
||||||
lankFor: (thangID) -> @lanks[thangID]
|
lankFor: (thangID) -> @lanks[thangID]
|
||||||
|
|
||||||
onNewWorld: (e) ->
|
onNewWorld: (e) ->
|
||||||
|
|
|
@ -229,7 +229,7 @@ module.exports = Surface = class Surface extends CocoClass
|
||||||
|
|
||||||
updateState: (frameChanged) ->
|
updateState: (frameChanged) ->
|
||||||
# world state must have been restored in @restoreWorldState
|
# world state must have been restored in @restoreWorldState
|
||||||
if @playing and @heroLank and not @mouseIsDown and @camera.newTarget isnt @heroLank.sprite and @camera.target isnt @heroLank.sprite
|
if @playing and @currentFrame < @world.frames.length - 1 and @heroLank and not @mouseIsDown and @camera.newTarget isnt @heroLank.sprite and @camera.target isnt @heroLank.sprite
|
||||||
@camera.zoomTo @heroLank.sprite, @camera.zoom, 750
|
@camera.zoomTo @heroLank.sprite, @camera.zoom, 750
|
||||||
@camera.updateZoom()
|
@camera.updateZoom()
|
||||||
@lankBoss.update frameChanged
|
@lankBoss.update frameChanged
|
||||||
|
|
Loading…
Reference in a new issue