mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-14 05:55:00 -04:00
Fixed choosing the first frame for segmented sprites.
This commit is contained in:
parent
b3ae258bed
commit
4a6e8018e4
1 changed files with 12 additions and 1 deletions
|
@ -47,7 +47,18 @@ module.exports = class SegmentedSprite extends createjs.SpriteContainer
|
|||
@frames = (parseInt(f) for f in @frames.split(',')) if @frames
|
||||
@animLength = if @frames then @frames.length else @baseMovieClip.timeline.duration
|
||||
@paused = true if @animLength is 1
|
||||
@currentFrame = if randomStart then Math.floor(Math.random() * @animLength) else 0
|
||||
|
||||
if @frames
|
||||
if randomStart
|
||||
@currentFrame = @frames[_.random(@frames.length - 1)]
|
||||
else
|
||||
@currentFrame = @frames[0]
|
||||
else
|
||||
if randomStart
|
||||
@currentFrame = then Math.floor(Math.random() * @animLength)
|
||||
else
|
||||
@currentFrame = 0
|
||||
|
||||
@baseMovieClip.gotoAndStop(@currentFrame)
|
||||
movieClip.gotoAndStop(@currentFrame) for movieClip in @childMovieClips
|
||||
@takeChildrenFromMovieClip()
|
||||
|
|
Loading…
Add table
Reference in a new issue