How to make Press Start to Start game and Game Over ending

So, here I am at the Web Platform → Web Shoot 'Em Up game trying to make my own little game out of it.

I’ve been wondering about this but have NO clue how to do it.
Know at the very beginning of a game you’ll get a screen saying ‘press enter to start game’?
Or when you die in a video game and that image pops up ‘Game Over!’
Or at the very end of the game ‘Congratulations! You’ve reached the end of the game!’
I want to make that for the Web Platform → Web Shoot 'Em Up game, but how?
And I want it to be so the game won’t start until you click enter, and when you die all the enemies freeze, not keep scrolling.
And at the end, when you finish, you’ll get an image pop up saying ‘end of game! yay!’ and not to where the game screen will keep scrolling.

How??

Thank you in advance for any help you can give with this!

Okay so make a sprite that says ‘press enter to start game.’ Create it on beginning of scene, then delete it when return key is pressed. You’ll need an event to check for that keypress. We’ll call this event 1.

Set all in game events to have if Variable(gamestarted) = 1 as a condition. Start the scene with Variable(gamestarted) set equal to zero. Only set this to 1 when the game is started. i.e. In event 1 actions you want to set Variable(gamestarted) = 1.

At the end of game, set gamestarted to zero again and all in game actions will stop.

Thanks again for your help with this, but I’m still sort of stuck.

Sorry for asking this (and I know it seems tiring).
What exactally do I write and where should I put it at in the Events? (I’ve been relentlessly pestering with this the past hour trying what you wrote and it’s not doing what I want. Clearly I’m still doing something wrong, but I just don’t understand what. Sucks to be so new at this. Really it does.)
This is what I’m looking at. Just tell me what to write and where at so I won’t keep messing up. (Hopefully that’ll give me enough of a springboard to use so I’ll finally get it right.)
http://s11.postimg.org/mg7w7vx41/where_do_they_go.jpg

I tried to write out every step exactly so this is quite long.

Okay so all the stuff you see on the left are conditions. Only if all the conditions are met does the computer execute the actions, which are on the right.

So first of all, at the top, you can see there are two events with the condition ‘at the beginning of the scene’. On either of those, on the right hand side, add the action ‘set variable gamestart to 0.’ You will find this in all actions → Variables → Value of variable.

Okay, next we need to make sure that no in game events are happening until the game is started, so you need to go through all the other events (5,6,7,8,10 etc…) and in the conditions (that’s on the left) add Variable(gamestart) = 1. You will find this in Variables → Value of variable.

Now we need to check for the keypress. Make a new event. You can do this by clicking events on the very top tabs and then hitting ‘Add an event’ which is kinda in the top left of the screen. On the conditions put ‘the key return is pressed’ which you will find in keyboard → A key is pressed and you want to type “Return” , without quotes in the box. On the actions, add the action ‘set variable gamestart to 1.’ You will find this in all actions → Variables → Value of variable.

Okay, now the game will not do anything until you press return.

To tell the player to press return…

Go in your favourite image editor ( I use GIMP: gimp.org/ ) and make a text that say ‘press enter to start’ or whatever. Save it as start.png somewhere easily findable.

Now go into Game Develop and hit Scene , which is on the top most tabs. Then hit objects editor , which is just below and to the left and has a red, a blue and a green block as its symbol. It should open up a little objects editor tab. Right click in it and click on add an object. Select sprite. The object should then appear in the list. Click on the object name and rename it to mystart. Then double click on it. It should bring up a window called Edition of a Sprite object. Click the green plus in the top left corner of this window and find your start.png image. That will then be added to the image list just below the plus sign. Look along the image list for your start.png and drag it into the blank images section at the bottom. Ok, you can now close this down and your sprite is ready. This is the general method to add any sprites to games…

You can now go to the scene on the tab where you have scene/events. Drag your object onto the scene, then double click it and where it says Z-Order, set that to 99. This will ensure the object remains on top of all others.

Okay, last thing. Go back to your events editor. Go back to the event we made where we checked for a keypress. Add to the actions list (where there is currently only ‘set variable gamestart to 0.’) delete object mystart. You will find this under All objects → Objects → Delete an object → Type mystart into the box.

eh… This was long to type. Might make some tutorials for all this stuff at some point.

This could be great, you can absolutely create a new article/tutorial on the wiki if you are willing to do so :slight_smile:

Dx121, instead of asking questions about such, well, basic stuff, why you just don’t play with software until you do what you want? When I learned to code (Was kinda bored 10 year old kid), I did it through trial and error. If something doesn’t work, try something different until it works. Then analyze what made it work, as opposed to previous attempts. And you will learn.

I mean your computer won’t burn in flames if you make something bad.

In my opinion no point to try to modify a complete game without any experience, better to start from scratch and learn your way up.
Because of that, I wont tell you how to modify the example, but I tell you the idea of how to make things you asking.

First of all, you need two scenes, the second scenes contains the actual game, the first scene need to be empty no game objects, only a sprite object or text object added to the scene, to show “Press Enter to start”.
In the events of the first scene, you need to add a condition to test if the enter key is pressed by using the Keyboard\A key is pressed condition. Once the enter key is pressed, add an action to change the scene by using the Scene\Go to scene action.
Enter the name of the second scene that contains the actual game. In short, the first scene only show the message to press enter, and wait until enter is pressed. Once enter is pressed, it change the scene to the actual game scene

Return key is pressed : Go to scene "scene 2"

Or you can use Layers. The Base layer contain the actual game but make it hidden by default, an other Layer contain the message. If enter key is pressed, the message Layer is hidden, the game Layer is Shown.

Return key is pressed : Hide Layer message and Show Layer Game

But in this case the game running in the background, to pause it, need to check if a Layer is displayed and run the game events only if it displayed by using the Layers and Cameras\Visibility of Layer condition

First of all, you need to use a variable to store the information if the player is dead or alive. To check if the player is alive or dead, need to check the number of the player object present in the scene by using All objects\Objects\Number of objects condition. If the number of player > 0 set the value of scene variable by using Variables\Value of variable action. Enter a name of the variable, for example player. enter the value “1” the sign is “=” (player = 1) which means the player is alive because the value is 1 when the number of player is > 0. To check if the player is dead, deleted, simply check again the number of player object present in the scene, but this time the sign is < and the value is 1. If the number of player object < 1, change the value of the scene variable but this time change the value to “0” (player = 0). This means the player is dead because the value is 0 when the number of player is < 1. Now, to show message only if player is dead so the variable player = 0, simply add a message to the scene as a sprite object (image) or text object, and hide the message object if the player is alive (player = 1) and show the message object if the player is dead (player = 0) by using the All objects\Visibility\Hide or Show an object Action.

The number of player > 0 : Do 1 to variable player
The number of player < 1 : Do 0 to variable player
Variable player = 1 : Hide the object Game Over message
Variable player = 0 : Show the object Game Over message

If you want to pause the game if player is dead, simply add condition to check the value of variable everywhere. If player is alive (player = 1) then enemy move, shoot, timer count…etc If enemy is dead (player = 0) everything going to stop as all the conditions are false.

You need a sensor object at the end of the level, to check if the player is reached that position and you need a variable to store that information. The sensor object can be anything, a tile, an item a wall, anything you can think of.
First of all, you need to check collision between the player and the sensor object by using the All objects\Collision\Collision Condition. Enter the name of the player object and the name of the sensor object. We need to test 2 conditions. If the player is colliding with the sensor object (reached the end), and if the player is not colliding with the sensor object (not reached the end). You can check if the object is not colliding with the sensor object by using the All objects\Collision\Collision Condition BUT this time, check the box on the bottom “invert condition” which means that we are going to check if the two object is NOT colliding. If the player is not colliding with the sensor, set a scene variable by using Variables\Value of variable action and name it for example end and add the value 0 (end = 0). If the player is in collision with the sensor object, change the value of the scene variable to 1 (end = 1). Now we are store the information if the player is colliding with the sensor object or not, inside the end variable. With the “end” variable we can check if the player is reached the end or not. If end = 0 the player is not reached the end because not colliding with the sensor object. If end = 1 the player is reached the end because the player is in collision with the sensor object. From this point you have to do exactly the same as above with the Game Over message. If end = 0 hide message, if end = 1 show message.

Player is in collision with sensor : Do 1 to variable end
Player is NOT in collision with sensor : Do 0 to variable end
Variable end = 1 : Show the object Congratulations message
Variable end = 0 : Hide the object Congratulation message

If you want to pause everything if player is reached the end, simply check the value of end variable everywhere. If end = 0 enemy move, shoot…etc in other case everything is stopped.

Hope it helps.