Fixed bobbing. Increased LayerAdapter cleanup vengeancy. Allow dragging without snapping when playback is at the end.

This commit is contained in:
Nick Winter 2014-10-06 15:04:33 -07:00
parent 0fefd627fa
commit b286b24f27
3 changed files with 7 additions and 5 deletions

View file

@ -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 = {}

View file

@ -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: -> "<LankBoss: #{@lankArray.length} lanks>"

View file

@ -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