mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 23:58:02 -05:00
TrailMaster plays/pauses animations along with the rest of the Surface.
This commit is contained in:
parent
c23fb1d2b5
commit
c40a7c1bb8
2 changed files with 12 additions and 1 deletions
|
@ -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()
|
||||
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue