From b286b24f27a2ff68787aa8c0c348144bd4a3d123 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Mon, 6 Oct 2014 15:04:33 -0700 Subject: [PATCH] Fixed bobbing. Increased LayerAdapter cleanup vengeancy. Allow dragging without snapping when playback is at the end. --- app/lib/surface/Lank.coffee | 7 ++++--- app/lib/surface/LankBoss.coffee | 3 ++- app/lib/surface/Surface.coffee | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/lib/surface/Lank.coffee b/app/lib/surface/Lank.coffee index 54e839539..938217d63 100644 --- a/app/lib/surface/Lank.coffee +++ b/app/lib/surface/Lank.coffee @@ -171,8 +171,9 @@ module.exports = Lank = class Lank extends CocoClass update: (frameChanged) -> # Gets the sprite to reflect what the current state of the thangs and surface are 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 - @updatePosition() if frameChanged or @thang.bobHeight or @notOfThisWorld frameChanged = frameChanged or @targetScaleFactorX isnt @scaleFactorX or @targetScaleFactorY isnt @scaleFactorY if frameChanged @handledDisplayEvents = {} @@ -198,7 +199,7 @@ module.exports = Lank = class Lank extends CocoClass @handledDisplayEvents[event] = true args = JSON.parse(event[4...]) key = 'aoe-' + JSON.stringify(args[2..]) - + unless key in @options.groundLayer.spriteSheet.getAnimations() args = JSON.parse(event[4...]) 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 return unless action = @getActionDirection() @playAction(action) if action isnt @currentAction - + lockAction: -> (@actionLocked=true) getActionDirection: (rootAction=null) -> diff --git a/app/lib/surface/LankBoss.coffee b/app/lib/surface/LankBoss.coffee index 99cad21a3..ea7ef609d 100644 --- a/app/lib/surface/LankBoss.coffee +++ b/app/lib/surface/LankBoss.coffee @@ -47,6 +47,7 @@ module.exports = class LankBoss extends CocoClass @removeLank lank for thangID, lank of @lanks @targetMark?.destroy() @selectionMark?.destroy() + lankLayer.destroy() for lankLayer in _.values @layerAdapters super() toString: -> "" @@ -248,7 +249,7 @@ module.exports = class LankBoss extends CocoClass wallLank.updatePosition() # console.log wallGrid.toString() @cachedObstacles = true - + lankFor: (thangID) -> @lanks[thangID] onNewWorld: (e) -> diff --git a/app/lib/surface/Surface.coffee b/app/lib/surface/Surface.coffee index ca3bf5f57..980085db8 100644 --- a/app/lib/surface/Surface.coffee +++ b/app/lib/surface/Surface.coffee @@ -229,7 +229,7 @@ module.exports = Surface = class Surface extends CocoClass updateState: (frameChanged) -> # 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.updateZoom() @lankBoss.update frameChanged