Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #216 - Animation looping problem #78

Closed

Conversation

IQAndreas
Copy link
Member

Non-looping animations now loop properly
AdamAtomic#216

I'm tired, and there are too many "ands", "ors", and "nots" for me to
check the answer in my head, so I trust Camasthecat's fix. ;)
(and according to @test84, it should be working)

Non-looping animations now loop properly
AdamAtomic#216

I'm tired, and there are too many "ands", "ors", and "nots" for me to
check the answer in my head, so I trust Camasthecat's fix. ;)
@moly
Copy link
Member

moly commented Sep 14, 2012

I can't recreate this issue at all. Playing an animation with looped set to false works already without this fix. Does anyone know the required steps to reproduce the problem?

@IQAndreas
Copy link
Member Author

Hm... I think you are correct. I had to take another look at what was going on and it took me a few times to get it clear (I blame the fact that it's been a long day at work and now close to midnight).

In a nuthsell, that long line of 'ands' and 'ors' does the following:
If that animation (and not a different one) is still playing (or if it is on a loop which means it is ALWAYS playing), don't restart it from the beginning.

The way Adam had it should be correct (if I'm reading it correctly).

With this fix a non-looping animation will actually not loop.

This quote by Camasthecat leads me to believe that he misunderstood the purpose of that line. Perhaps you can double check by asking in that issue (which will give them reply notifications for it).

@Dovyski
Copy link
Member

Dovyski commented Sep 14, 2012

I din't try to reproduce it, but I agree with @IQAndreas.

The important part of all those 'ands' and 'ors' related to the bug is the _curAnim.looped || !finished term, which means: "if current anim IS looped, do nothing" and "if current anim IS NOT looped, but it has not finished playing yet, do nothing as well".

There seems to be no bug at all.

@moly
Copy link
Member

moly commented Sep 15, 2012

I think I've figured this out. He must have been calling play() from the update loop, which would cause the non-looped animation to repeat:

override public function create():void
{
    sprite = new FlxSprite();
    sprite.loadGraphic(Img, true);
    sprite.loadAnimation("name", [0,1,2,3,4], 10, false);
    add(sprite);
}

override public function update():void
{
    super.update();
    sprite.play("name");
}

His proposed "fix" causes play() not to do anything if the current animation is not looped, so the above code would actually "work" as he expected. Basically, I believe the issue was caused by user error and not a bug in flixel. I recommend the issue be closed without merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants