Sign in to follow this  
mattasaurus

help with timeline config/onComplete

Recommended Posts

I'm setting up a Timeline and I'm doing something wrong. I want to do this:

                var oc = function () { playerMoving = false; };
                var timeline = scene.tweens.createTimeline({ onComplete: oc });

but this doesn't work (onComplete is null when inspecting in the debugger and doesn't trigger).

I see that createTimeline() accepts a config, uses TimelineBuilder.js, and  https://github.com/photonstorm/phaser/blob/06998276ec670ceac942f44d344cea8b8af98578/src/tweens/builders/TimelineBuilder.js#L132 seems to apply that config. Seems something like the above should work.

I was able to force my callback into the timeline like this:

                var oc = function () { playerMoving = false; };
                var timeline = scene.tweens.createTimeline();
                timeline.setCallback('onComplete', oc, [timeline], timeline);

but this is a hack, it can't be the right way.

I'm probably missing something really simple, can anybody point it out?

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.