diff --git a/app/lib/surface/Surface.coffee b/app/lib/surface/Surface.coffee index 7e65b0888..704f41b80 100644 --- a/app/lib/surface/Surface.coffee +++ b/app/lib/surface/Surface.coffee @@ -312,10 +312,12 @@ module.exports = Surface = class Surface extends CocoClass if paused @surfacePauseTimeout = _.delay performToggle, 2000 @lankBoss.stop() + @trailmaster?.stop() @playbackOverScreen.show() else performToggle() @lankBoss.play() + @trailmaster?.play() @playbackOverScreen.hide() diff --git a/app/lib/surface/TrailMaster.coffee b/app/lib/surface/TrailMaster.coffee index 93b22d8ba..55731be8d 100644 --- a/app/lib/surface/TrailMaster.coffee +++ b/app/lib/surface/TrailMaster.coffee @@ -14,6 +14,7 @@ module.exports = class TrailMaster extends CocoClass constructor: (@camera, @layerAdapter) -> super() @tweenedSprites = [] + @tweens = [] @listenTo @layerAdapter, 'new-spritesheet', -> @generatePaths(@world, @thang) generatePaths: (@world, @thang) -> @@ -32,6 +33,7 @@ module.exports = class TrailMaster extends CocoClass cleanUp: -> createjs.Tween.removeTweens(sprite) for sprite in @tweenedSprites @tweenedSprites = [] + @tweens = [] createGraphics: -> color = @colorForThang(@thang.team, PAST_PATH_ALPHA) @@ -96,12 +98,19 @@ module.exports = class TrailMaster extends CocoClass sprite.y = y container.addChild(sprite) if lastSprite and options.animate - createjs.Tween.get(lastSprite, {loop: true}).to({x:x, y:y}, 1000) + tween = createjs.Tween.get(lastSprite, {loop: true}).to({x:x, y:y}, 1000) @tweenedSprites.push lastSprite + @tweens.push tween lastSprite = sprite @logged = true container + + play: -> + tween.setPaused(false) for tween in @tweens + + stop: -> + tween.setPaused(true) for tween in @tweens destroy: -> @cleanUp()