# Simple PAUSE

Post your own tutorials, guides and demos.

### » Wed May 02, 2012 10:29 am

Just want to share this to newbies. Once you get the logic behind the following events, it'll help you with more complex toggle in the future:

It's just a simple PAUSE command when you press ESC:

You will find the original tutorial on toggling states here:
http://www.scirra.com/tutorials/158/veryvariable-toggle-between-two-states

Hope this helps alot for non-programmer noobs like me.
B
5
S
1
Posts: 2
Reputation: 639

### » Wed May 02, 2012 12:22 pm

thanx a lot!
that was very needed!
B
14
S
4
G
2
Posts: 91
Reputation: 2,435

### » Tue May 08, 2012 9:47 pm

B
13
S
4
G
1
Posts: 63
Reputation: 1,170

### » Wed May 09, 2012 2:20 am

Another method is to start at 1, and change it to Pause * -1 when Esc is pressed. Then you can use 1 for timescale 1, and -1 for timescale 0.
Construct Classic - Examples Kit Dropbox is a pile of trash and if you need my old files PM me! :)
B
133
S
43
G
18
Posts: 2,246
Reputation: 20,754

### » Wed May 09, 2012 2:46 am

Well, you can use pretty much any 2 numbers for variables. If you wanted, you could use 100 and 101.
B
13
S
4
G
1
Posts: 63
Reputation: 1,170

### » Wed May 09, 2012 3:47 pm

[QUOTE=Gelidaer] Well, you can use pretty much any 2 numbers for variables. If you wanted, you could use 100 and 101.[/QUOTE]

Right, I meant that using 1 and -1 means you can get rid of the event "pause > 1" as you toggle the value in the "Escape" event (set pause = pause * -1). Otherwise it's the same.Jayjay2012-05-09 15:48:15
Construct Classic - Examples Kit Dropbox is a pile of trash and if you need my old files PM me! :)
B
133
S
43
G
18
Posts: 2,246
Reputation: 20,754

### » Wed May 09, 2012 3:58 pm

It's good to find people with brain ;-p ... never think to do this like that but now seems to me so obvious !

Thanks !!!
B
18
S
5
G
3
Posts: 298
Reputation: 5,332

### » Wed May 09, 2012 5:43 pm

Oh, that's what you meant Jayjay. It saves up on 1 event, thanks! I also noticed that variables that are not time based (ex: Up Arrow is down>Add one to 'Variable') are not affected by this. Just a heads up to put a condition on those types of variables (ex: Up Arrow is down & 'Pause' is equal to 1>Add one to 'Variable').
B
13
S
4
G
1
Posts: 63
Reputation: 1,170

### » Wed May 09, 2012 6:59 pm

@Gelidaer, you can't use conditions like these:
==> Up Arrow is down>Add one to 'Variable'
If you do your game will react different in every FPS rate, ex. 60 fps will add 60 to the variable every second, 15 fps will add 15 to the variable every second, so alwyas use Timedelta to EVERY thing you do.
Always test your game in the lowest possible FPS rate, and in unlimited FPS rate.
And for the pause problem that you mentioned, the best solution is to create a group (i named it Runtime) and add almost every event of your layout on this group, when pause happens disable this group in addition to the timescale reduction.
B
22
S
7
G
5
Posts: 90
Reputation: 3,430

### » Wed May 09, 2012 11:24 pm

@Metal_X, thanks. Didn't know that's how it worked.
B
13
S
4
G
1
Posts: 63
Reputation: 1,170

Next