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

0 favourites
From the Asset Store
Awardkit
$5 USD
Create custom awards and achievement or use the many templates and create your own.
  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • EmperorIng360 i dont have in system: 'exit application', you have?

  • 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.

  • Thanks for your help Emperorlng

  • Use the Browser's plugin "Close" action.

  • Don't do that--instead, have a layout that is your Start Page, and when you press Quit you simply go to that layout.

  • Kyatric

    Yes, it worked for me!

    Thanks! <img src="smileys/smiley32.gif" border="0" align="middle" />

  • 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 ...

  • 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.

  • Pause Function

    Keyboard > On P Pressed > Set time scale 1 - timescale

  • For pause, I use a function "pause"...

    Functions is a god kind of pause in you system.

  • Any one know how to give back button functionality...

  • I see you guys use the word browser a lot saying stuff like "a Construct 2 game is not an application - it's a browser-based type of thing" and "Use the Browser's plugin "Close" action."

    But I plan to use CocoonJS to make an iOS game with it, that people can download of the appstore... woudln't that be a standalone app, they would still play it in a browser?

    As for a Back button Bhumika I just created a button on each menu page, named it Back, and then I went to the event sheet of each page and added a event Back[on clicked] add action System>Go to Menu(main) where Menu(main) is the name of my start screen that has start game, options, credits, quit game, etc. buttons. Hope that helps.

  • im wonderimg how do you make a quit button for say a menu on PC vertion?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)