How do I make a pause layer properly?

0 favourites
  • 3 posts
From the Asset Store
Create large maps with dynamic depth and precise sprite layering control in top-down games.
  • Please hear me out first. Yes, I know that the pause tutorial is out there somewhere but, whenever I created Pause Menu, that is created another layer just to show the pause menu. There is Play button, Mute button and Quit button. I set it to Invisible and it will visible whenever player press pause. But there is something strange happened, while the player is playing, not even press the pause button, the quit and the mute button is sometimes activated! So, the player will play the game and they keep clicking and then, poof! They back to the main screen. Is that a bug or what? Is invisible and visible layer is buggy? I don't know.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Invisible buttons (or buttons on invisible layers) can still be clicked.

    You need to add another condition to your "On QuitButton clicked" event - something like "Is Layer PauseLayer visible" or "Is GamePaused".

    Another way to do this is to move all PauseLayer events to a separate group in your event sheet, and disable this group. Enable it only when player presses pause.

    By the way, you should also be aware, that when your PauseLayer is visible and you click a button on it, this click may be registered by your main game events - your character will fire a weapon or something like that. So you need to disable game controls group when you activate PauseLayer.

  • Hi OP,

    As dop2000 said, every single clickable in your game is actually enabled at all times. I am doing a game with multiples menus stacked on top of each other on something like half a dozen layers, and when I discovered I was clicking on half of them at the same time on one click, I wasn't really happy.

    I used groups activation/deactivation to manage this problem efficiently with a minimum of events. All you have to do is program your buttons on your layer, put all these events in a group, and ass a single event saying "is layer X visible" => activate "group", and of course, its opposite, "is layer X invisible" => deactivate "group".

    Really easy !

    Enjoy your game !

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