How do I Make a Functioning Game Over Screen?

0 favourites
  • 4 posts
From the Asset Store
Is a circular loading screen with code ready to use. No Animation.
  • Hello, everyone! I'm having an issue here that I'm breaking my head over, and what I would like is so simple. I'm trying to make a game over screen- and so far, I have the design and a working 30-second countdown.

    What I'm looking for is a way so that when the player presses the space bar, the game takes you back to the last layout you were in, at the very beginning. The 'previous layout' function works with the specific and manual ordering of the layouts in the Projects bar, which is not what I want. I've also attempted the 'Global Variable: Source Layout=LayoutName' tactic, to no avail. Does anyone have a clue as to how I can go about this? Any help would be greatly appreciated!! Thanks in advance.

  • Firstly, I'm assuming your game over screen is a separate layout. You probably don't need to do this - just make it a layer that appears on top of your current layout. Then all you need to do is system-restart layout.

  • Firstly, I'm assuming your game over screen is a separate layout. You probably don't need to do this - just make it a layer that appears on top of your current layout. Then all you need to do is system-restart layout.

    Alright, so I managed to convert the separate layout into a global layer which works just fine. So I thank you for that tip!! But now I've run into a new issue: No matter what I do, I can't get the 30 second countdown to function, nor the music that is supposed to play when the layer is visible.

    I can't post a screenshot of my programming because I'm on my phone right now, but I have it as this:

    [ Layer 'GAMEOVERSCREEN' is visible ]:

    System; set game over_countdown to 30

    Audio; stop all

    System; wait 0.1 seconds

    Audio; play GAMEOVER looping

    Text; Game over_Countdown: set visible

    [ Subevent; Every tick ]:

    Text; set text to Game over_Countdown

    [ Subevent; Every 1.0 seconds ]:

    System; subtract 1 from Game over_Countdown

    [ Subevent; Game over_Countdown = 0 ]:

    System; Go to TITLE

    [ Subevent; Keyboard; On Space Pressed ]

    [ Condition; Game over_Countdown > 0 ]:

    Restart layout

    ...Any ideas??

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think your main event "[ Layer 'GAMEOVERSCREEN' is visible ]:" is running every tick (while your game over screen is visible). So every tick it is stopping the audio, and setting the countdown timer back to 30.

    The single run actions associated with your game over screen should be in the event that triggers the game over to begin with (what event causes your game over layer to become visible?). In that same event, you should run all the actions that you want only to trigger once.

    A function can be useful in scenarios where you have many separate conditions that trigger game over, so you don't have to copy the same actions over and over again.

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