Godot 3 - How to pause game?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] while the reading you Cohen's I came to the conclusion that you would like to know how to make a pulse I split this video to three main parts fast solution little theory and how to make a continue button in the last tutorial I showed how to use auto load functionality if you don't know what it is I encourage you to watch it right now making a long story short we can use auto load scenes anytime during the game once added it will be always auto loaded the project already has two levels moveable character and with the controller but this method will work for any game let's create a new scene that will be a canvas layer node and add a script we I will tell you why to use this node later in the input listener function we will catch the escape button which is under oh I cancel by default of course you can use any key you want in our case there will be only one line of code get three posts is equal to negative get three post in this way will toggle our post game status we also need to add our scene to auto Lots resources project project settings auto loads the last thing is to change pulse mode for this scene to process and tada we have a working pulse you can see that when I'm pressing the escape button every ring has stopped in this case music and player animation it's time for every indicator engine we have a master note which is a three all notes scenes that we add in the editor are children of this tree like levels layer note enemy note weapon note fuel out a lot and so on all these elements have a post variable when it's active all 2d or 3d processes like rendering caching signals and other calculation will be stopped also all inputs for these nodes will be stopped by default all elements have inherited which means that we'll use pal status from a parent so by chaining post status in the tree we will change it everywhere but we also need the possibility to change the status back to false that's why I change pulse mode in the pulse into process using this state the note will always proceed no matter of behavior of the tree continue button is nice to give feedback for the player that the game is unpause so let's make fullscreen darker a good note touch if this is a canvas layer this is an old that's odd a separate to deal a rendering layer which will be independent no matter what we will do at the game level perfect choice for had the easy way to achieve this effect is to use a black texture I prepared one here nothing special simple rectangle let's add texture rect note and expand it to full screen using layout full erect in this way we resize the note now use texture by drag-and-drop and expand it now we need to modify this not to have transparency let's go to visibility settings and change alpha to something like 50% let's also change the name of this node and update the script to also toggle visibility espouse status it's important to have a hidden background in the building now we have visual feedback for pulse and let's add more option like continue button let's use the standard button note set text to continue move it to the center using layout Center and make it flat now let's add signal to our script the turn of post status we can also improve our script by creating a set visibility function with the is visibility parameter to have all visibilities in one place let's use a loop to get all elements of this note-for-note in get children node visibility is equal is visible we can also use the function in their ready note to be sure that the postman is hidden we have a working pause menu we can get back to the game by pressing a button our Escape key bonus we can add more options for example toggle fullscreen we need to add a new button let's call it fullscreen edit text and move it to the center of the screen next add signal on press and add OS window full screen is equal negative OS window full screen and you can see it was very easy to do and that's all over this tutorial I also want to thanks for pixel frog for sharing these great assets they are for free and links are in the description and of course the thanks you for watching and support like if you liked it dislike if you didn't have a great date night and so on [Music]
Info
Channel: Rafa Fiedo
Views: 18,544
Rating: undefined out of 5
Keywords: godot how to pause game, godot games, godot tutorail, godot engine, games made with godot, godot platformer, godot 3.2, godot 2d tutorial, godot 3d tutorial, godot 2d, godot 3.2 tutorial, godot pause, godot, godot continue button, godot pause mnu, godot pause screen, godot pause button, godot pause mode, godot pause script, godot pause node, pause tutorial, godot pause tutorial, godot menu, godot menu button
Id: WaotOuDNio8
Channel Id: undefined
Length: 6min 0sec (360 seconds)
Published: Thu Jul 09 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.