Default animation speed affecting all animations

Bugs will be moved here once resolved.

Post » Sat Mar 01, 2014 3:49 pm

Whoa, my apologies @shinkan, @genkigenga, I stand corrected :)

There does seem to be a bug when the first animations speed is set to 0, that on start of layout, it does not set the speeds for the other animations of the same instance.

I did a quick test with adding a click on the animation, that it sets anim2, and when done it does start the animation

@shinkan wrote:lennaert seriously do you read what I wrote?



I did, but did not do exactly do the actions how you described it. thus not running into the issue.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Sat Mar 01, 2014 3:52 pm

uff, finally haha... No worries man! :)
Glad it's all sorted and we have a bug confirmation.
ImageImageImageImage
B
158
S
66
G
43
Posts: 2,603
Reputation: 35,868

Post » Sat Mar 01, 2014 3:57 pm

No worries and thanks guys. Glad to see the forum is still as friendly as it was. :)
ImageImage
B
130
S
23
G
7
Posts: 1,078
Reputation: 13,280

Post » Sun Mar 02, 2014 3:11 am

Yup, this is definitely a bug. Changing the speed of the first animation to 0 shouldn't affect the behavior of other animations.
And looking into the plugin, the bug seems kind of obvious.
In instanceProto.onCreate:
Code: Select all
      if ( !(this.type.animations.length === 1 && this.type.animations[0].frames.length === 1)   &&
             this.type.animations[0].speed !== 0)
      {
         this.runtime.tickMe(this);
         this.isTicking = true;
      }

Which, to me, is easier to understand removing the NOT at the beginning which gives you:
Code: Select all
      if (  (this.type.animations.length !== 1 || this.type.animations[0].frames.length !== 1)   &&
             this.type.animations[0].speed !== 0)
      {
         this.runtime.tickMe(this);
         this.isTicking = true;
      }

Which translates to: tick the sprite only if [it has a more than one animations OR if the first animation has more than one frame] AND if the first animation has a speed different of 0.
So, if the first animation has a speed of 0, the sprite will not be ticked until you change animation or set the speed in event.

For a fix, I would propose that (moving the check after setting this.cur_animation):
Code: Select all
        this.cur_animation = this.getAnimationByName(this.properties[1]) || this.type.animations[0];
        this.cur_frame = this.properties[2];

        if (this.cur_animation.frames.length > 1 && this.cur_animation.speed !== 0)
        {
            this.runtime.tickMe(this);
            this.isTicking = true;
        }

We get the information about current animation, and then according to its length and speed, we tick the sprite or not (:

(not sure I understand why in current code there's a check to know if the number of animation is greater than 1... In Acts.prototype.SetAnim, the ticking is set back on as soon as you set any animation anyway... which is kind of weird, there should be a check for speed and frame count as well)
B
68
S
22
G
14
Posts: 1,485
Reputation: 16,561

Previous

Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 3 guests