Best Method To Implement Pause?

Get help using Construct 2

Post » Thu Feb 14, 2013 1:39 pm

Best Method To Implement Pause?

Hi,

What is the best method to implement a pause system?
Would like the game to toggle pause when "p" is pressed on the keyboard.
I know how to read the keyboard, just don't know what to do after that.
Everything should stop when pause is enabled.
Any help would be appreciated, thanks!

You can download my project here:
http://16bitsoft.com/V2/Files/RocksInSpace_Alpha3c/RocksInSpace_Alpha3c.capx

JeZ+Lee
B
11
S
3
G
4
Posts: 105
Reputation: 2,950

Post » Thu Feb 14, 2013 1:41 pm

When you press "p" make System -> Set time scale to 0 (that pauses the game)

Thats it. Setting it back to 1.0 resumes your game.
Working on "EVERBLAST"
Image
B
28
S
5
Posts: 217
Reputation: 2,654

Post » Thu Feb 14, 2013 1:46 pm

You can also use the "Pause" plugin here: http://www.scirra.com/forum/plugin-pause_topic46693.htmlLowren2013-02-14 13:46:51
B
20
S
5
G
3
Posts: 58
Reputation: 4,136

Post » Thu Feb 14, 2013 1:58 pm

[QUOTE=Kraudi] When you press "p" make System -> Set time scale to 0 (that pauses the game)

Thats it. Setting it back to 1.0 resumes your game.[/QUOTE]Hi,

Ok, I understand that.
I would also like to display "PAUSED" text when game is paused.
I've setup a "PAUSED" text, set it to be invisible at game start,
and gave it a variable "GameIsPaused" which is set initially to false.

How would I toggle the display of above "PAUSED" text?
Thanks!

JeZ+Lee
B
11
S
3
G
4
Posts: 105
Reputation: 2,950

Post » Thu Feb 14, 2013 2:03 pm

here is a quick example of a pause toggle button:

https://dl.dropbox.com/u/45711709/PauseToggle.capx
B
33
S
6
G
7
Posts: 338
Reputation: 7,424

Post » Thu Feb 14, 2013 2:06 pm

[QUOTE=JeZLee] [QUOTE=Kraudi] When you press "p" make System -> Set time scale to 0 (that pauses the game)

Thats it. Setting it back to 1.0 resumes your game.[/QUOTE]Hi,

Ok, I understand that.
I would also like to display "PAUSED" text when game is paused.
I've setup a "PAUSED" text, set it to be invisible at game start,
and gave it a variable "GameIsPaused" which is set initially to false.

How would I toggle the display of above "PAUSED" text?
Thanks!

JeZ+Lee[/QUOTE]

If you are setting the time scale to 0 also make the pause text visible.
If time scale is at 1 make it invisible
Working on "EVERBLAST"
Image
B
28
S
5
Posts: 217
Reputation: 2,654

Post » Thu Feb 14, 2013 2:24 pm

Hi,

Thanks for your help!

I came up with this, but it's not work properly?

When I press "p" key on keyboard it make one sound and then it does nothing?

What did I do wrong?
Thanks!

JeZ+Lee
B
11
S
3
G
4
Posts: 105
Reputation: 2,950

Post » Thu Feb 14, 2013 2:30 pm

Heres the solution



Edit: Little mistake. In the second Event, u have to make time scale to 1 =)Kraudi2013-02-14 14:31:19
Working on "EVERBLAST"
Image
B
28
S
5
Posts: 217
Reputation: 2,654

Post » Thu Feb 14, 2013 2:31 pm

because you've made no toggle like i did...

in your case both events fire and thats why it sets timescale to 0 and then instantly to 1.0 again :)

B
33
S
6
G
7
Posts: 338
Reputation: 7,424

Post » Thu Feb 14, 2013 3:35 pm

Uggg,

Can't get this to work...

Here is the project, someone please help make Pause work!
http://16bitsoft.com/V2/Files/RocksInSpace/Alpha3/RocksInSpace_Alpha3d.capx
Thanks...

JeZ+Lee
B
11
S
3
G
4
Posts: 105
Reputation: 2,950

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 20 guests