Default animation speed affecting all animations

0 favourites
From the Asset Store
3 pixel charaters with over 8 animations each + animations with a gun
  • Again, from the manual

    Sprite properties

    Animations

    Click the Edit link to open the Image and Animations editor for the object. All instances of the object type share a single set of animations.

    check bold part.

    Animation speed can vary between different animations.

    But it can not have varying speeds for the same animation of the same instance.

  • No one is talking about different speed for same animation in same instance

    open up and start preview. instance of the left have speed 5, instance on the right speed = 50

    open image editor, change speed for anim2 from 50 to 0. run preview again

    instance on the left keeps playing, instance on the right is stopped (0 speed)

    image editor again. change anim2 back to 50. Change anim1 from 5 to 0. Preview again.

    both instances are stopped.

    Edit: It looks like using Initial animation property is overriding and sets up speed for all animations, from one on top of the animations list (name of animation doesn't matter) in Image editor.

    Doing same thing with events (like on the image) works fine.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • That is because you just before set the speed to 0.

    You do realise, that if you update anim1 its speed to 0 in one of the instances, that it updates all instances anim1 speed to 0 speed.

    Same goes for any other animation of the same instance, updating an animation property will set it for all instances.

    And if you would simply give one of the anims speed 50, and the other 0, you will get one that stays still and the other one flickers.

    looky:

  • In your example Lennaert, change the first animation (anim1) speed to 0 and the second animation (anim2) to 50 and you will see the bug.

  • lennaert seriously do you read what I wrote?

  • 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

    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.

  • uff, finally haha... No worries man!

    Glad it's all sorted and we have a bug confirmation.

  • No worries and thanks guys. Glad to see the forum is still as friendly as it was.

  • 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:

    		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;
    		}
    [/code:fkgvvy1u]
    Which, to me, is easier to understand removing the NOT at the beginning which gives you:
    [code:fkgvvy1u]
    		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;
    		}
    [/code:fkgvvy1u]
    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:fkgvvy1u]
            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;
            }
    [/code:fkgvvy1u]
    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)
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)