Thang events now only appear once per whole frame, rather than for each interpolated frame.

This commit is contained in:
Scott Erickson 2014-05-17 11:27:54 -07:00
parent 736fc8c12f
commit 4be67113be
2 changed files with 5 additions and 1 deletions

View file

@ -591,12 +591,14 @@ module.exports = Surface = class Surface extends CocoClass
@mouseInBounds = mib
restoreWorldState: ->
@world.getFrame(@getCurrentFrame()).restoreState()
frame = @world.getFrame(@getCurrentFrame())
frame.restoreState()
current = Math.max(0, Math.min(@currentFrame, @world.totalFrames - 1))
if current - Math.floor(current) > 0.01
next = Math.ceil current
ratio = current % 1
@world.frames[next].restorePartialState ratio if next > 1
frame.clearEvents() if parseInt(@currentFrame) is parseInt(@lastFrame)
@spriteBoss.updateSounds()
updateState: (frameChanged) ->

View file

@ -36,6 +36,8 @@ module.exports = class WorldFrame
#console.log "Frame", @time, "restoring state for", thang.id, "in particular and saying it don't exist"
return
thangState.restore()
clearEvents: -> thang.currentEvents = [] for thang in @world.thangs
toString: ->
map = ((' ' for x in [0 .. @world.width]) \