How to create "Quit" and "Pause" button?

Get help using Construct 2

Post » Sun Sep 09, 2012 7:12 am

Hi all,
I am making a game using C2. I have a problem with making Quit and Pause button.
Pause button uses to pause game whenever player wants to interrupt the game while playing.
Quit button uses to exit the game.

I have tried to find event in C2 but i do not find it. Anyone has experiences with these buttons, please help.
Thanks
B
3
Posts: 5
Reputation: 485

Post » Sun Sep 09, 2012 8:04 am

For quitting:

On AnyKey pressed:
>System: Exit Application

That's the basic gist of it.

Making a working pause button is trickier because you have to set up a time scale, and have your events correspond with said time scale, to pause it. I would recommend reading up a lot on the delta-time stuff to get a better grasp of what you want to do.

Because to pause a game, you need to set the time-scale of the game to 0 (time-scale at runtime is at 1.0). You just need to make sure that the rest of the game's objects and events are running on that time-scale, which is a process I am not 100% sure how to accomplish.

Of course, I might be speaking of outdated knowledge since I haven't picked up the latest version of C2 for a few months. I don't think any magical pause plugin has been created, though.
B
19
S
3
G
2
Posts: 148
Reputation: 1,945

Post » Sun Sep 09, 2012 10:06 am

@EmperorIng360 i dont have in system: 'exit application', you have?
B
93
S
19
G
34
Posts: 1,840
Reputation: 27,963

Post » Sun Sep 09, 2012 5:44 pm

I'm sorry; I was going off of my knowledge in Construct Classic, which has that action.

Looking through my C2r92, it doesn't have an action "Exit Application"

Because, now that I think of it, a Construct 2 game is not an application - it's a browser-based type of thing.

So I don't quite know how you could 'exit' a browser-based game.

You could have an event that takes your game back to the main menu or title screen layout, though, with the system action "Go to Layout."
So I'm sorry for that.
B
19
S
3
G
2
Posts: 148
Reputation: 1,945

Post » Mon Sep 10, 2012 7:56 am

Thanks for your help Emperorlng
B
3
Posts: 5
Reputation: 485

Post » Mon Sep 10, 2012 8:59 am

Use the Browser's plugin "Close" action.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Mon Sep 10, 2012 1:29 pm

Don't do that--instead, have a layout that is your Start Page, and when you press Quit you simply go to that layout.
B
14
S
1
G
2
Posts: 85
Reputation: 2,810

Post » Sat Feb 23, 2013 4:04 pm

@Kyatric
Yes, it worked for me!
Thanks! ghale2013-02-23 16:24:17
B
10
S
4
G
4
Posts: 42
Reputation: 3,091

Post » Sat Feb 23, 2013 4:44 pm

You can set a layout timescale to 0 in the system object actions ...
That should pause your game ... Set it back to 1 to make your game continue

Cheers ...
B
34
S
16
G
16
Posts: 2,222
Reputation: 16,564

Post » Sun Feb 24, 2013 12:36 pm

For Pause I would recommend you use families rather than setting the whole layout's timescale to 0, otherwise any additionally actions like animating a pause menu popup would also be paused.

You can just add all the elements you want to pause to same family and on pause set the family's timescale to 0. If you have a mix of elements i.e. Sprites, Text and 9Patch, you can just make more than one Family, and set them all at the same time.
B
24
S
11
G
5
Posts: 140
Reputation: 5,004

Next

Return to How do I....?

Who is online

Users browsing this forum: Rezzon71, tarek2 and 24 guests