mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-28 01:55:38 -05:00
Thang events now only appear once per whole frame, rather than for each interpolated frame.
This commit is contained in:
parent
736fc8c12f
commit
4be67113be
2 changed files with 5 additions and 1 deletions
|
@ -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) ->
|
||||
|
|
|
@ -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]) \
|
||||
|
|
Loading…
Reference in a new issue