[Resolved] Director and timer.performWithDelay()

Hey gang,

I’ve searched the forums and the net and have had a few bites, but noting really solves my issue. Any help would be awesome!

So, I have a menu button that plays a sprite when it’s hit, and I want to delay the director call until the sprite has finished. Right now, the best best case scenario, I can get the scene to change, and the sprite finishes playing on my new scene.

Based on other posts, it looks like there are definite issues with director respecting the timer delay.

Does anyone have a solution to this??

Thanks!
–Kev [import]uid: 70550 topic_id: 23941 reply_id: 323941[/import]

try this:
timer.performWithDelay(delayTime,function() director:changeScene(“your_director”,“crossfade”,500)
end)
[import]uid: 125086 topic_id: 23941 reply_id: 96497[/import]

If you know how long the sprite plays for you could call the timer when the sprite starts, yes.

You can also check when the sprite is finished and change but this would be more code for the same result, so the lesser is preferable.

Peach :slight_smile: [import]uid: 52491 topic_id: 23941 reply_id: 96509[/import]

Aw thanks y’all!

That worked like a charm ay1czw2.

And Peach, thank you, and it’s great to meet you. Your tutorials are awesome!

:slight_smile:
–Kev [import]uid: 70550 topic_id: 23941 reply_id: 96516[/import]

Thanks Kev, I do my best! Nice to meet you too :slight_smile: [import]uid: 52491 topic_id: 23941 reply_id: 96522[/import]