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

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>"
@ -248,7 +249,7 @@ module.exports = class LankBoss extends CocoClass
wallLank.updatePosition()
# console.log wallGrid.toString()
@cachedObstacles = true
lankFor: (thangID) -> @lanks[thangID]
onNewWorld: (e) ->

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