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

Phaser-like countdowns #7

Open
oxysoft opened this issue Oct 23, 2016 · 0 comments
Open

Phaser-like countdowns #7

oxysoft opened this issue Oct 23, 2016 · 0 comments

Comments

@oxysoft
Copy link

oxysoft commented Oct 23, 2016

One thing I absolutely loved during the time I used Phaser for HTML5 game development is the way you did countdowns and timers.

If we could do timers and countdowns like this, it would be insanely useful

new Countdown(5f, () => {
    Destroy(gameObject); // run this code after 5 seconds
});

I love this method of doing things because the code that runs after the countdown is grouped together with its declaration. Super clean and useful. And, it makes it really easy to do things like this

new Countdown(0.5f, () => {
    Debug.Log("foo");
    new Countdown(0.5f, () => {
        Debug.Log("bar!");
    }
});

Prints foo after half a second, then bar after another half a second.

Of course, you should still be able to keep these countdown objects and cancel them at any time, or restart, etc. We're just changing the way you declare the code you wish to run on completion or progress.

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

No branches or pull requests

1 participant