How do I make a countdown

Get help using Construct 2

Post » Tue Apr 29, 2014 8:52 am

So in my game i need a countdown, from 3 to 0, and then the game begins. So i will need everything to be disabled when the countdown is going and enable everything when it hits 0.

Thanks for any help :)
B
3
Posts: 5
Reputation: 206

Post » Tue Apr 29, 2014 9:03 am

I'd say the absolute easiest way would be to have the control groups disabled by default, then run an event on startup that goes something like this:
Text > Set Text ("3")
Wait 1 second
Text > Set Text ("2")
Wait 1 second
Text > Set Text ("1")
Wait 1 second
Text > Destroy
Set control groups enabled

Not elegant by any means, but totally functional.
B
57
S
15
G
11
Posts: 912
Reputation: 12,626

Post » Tue Apr 29, 2014 9:06 am

Or you could take a look at timers. If it's 3 seconds or 3 min's it will still work the same, https://www.scirra.com/manual/167/timer

If you need more info post back after you check it out. Regardless both methods should work:)
B
63
S
17
G
5
Posts: 186
Reputation: 9,089

Post » Tue Apr 29, 2014 9:07 am

Way 1 =

Use the PAUSE plugin to set your entire game to pause.
Then Create a label (text) in the middle of the screen , (1. use one text and set its visibility 2.create a text)
then just use a global variable to hold the integer. then :
On start of layout -> Create Label - Set visible TRUE
Then just -> Every 1 Second -> subscract 1 from the global variable.

The last thing you need is a event for refreshing the text when it gets 1 less.
So if the global variable == 0 -> Disable pause -> make text invisible.
Efery Tick -> Set TEXT to &globalVariable

oh and i forgot you also need
B
27
S
7
G
3
Posts: 300
Reputation: 4,573

Post » Tue Apr 29, 2014 9:07 am

GeometriX wrote:I'd say the absolute easiest way would be to have the control groups disabled by default, then run an event on startup that goes something like this:
Text > Set Text ("3")
Wait 1 second
Text > Set Text ("2")
Wait 1 second
Text > Set Text ("1")
Wait 1 second
Text > Destroy
Set control groups enabled

Not elegant by any means, but totally functional.


hmm yeah this might be a more elegant way than i posted :D
B
27
S
7
G
3
Posts: 300
Reputation: 4,573

Post » Tue Apr 29, 2014 9:18 am

Thanks for the quick aswers :) I'll check it out :)
B
3
Posts: 5
Reputation: 206


Return to How do I....?

Who is online

Users browsing this forum: draiza and 8 guests