Тёмный

How to Code a Pause in Godot (tutorial) 

GDQuest
Подписаться 268 тыс.
Просмотров 51 тыс.
50% 1

Опубликовано:

 

20 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 92   
@McDumDum
@McDumDum 11 месяцев назад
IF YOU'RE COMING HERE IN 2023: This tutorial holds up. HOWEVER, make sure you set the control node's "Process" mode to "Always". He explains it here 5:22, except in 4.0, Pause Mode is renamed to "Process". You can also shorthand "not get_tree().paused" to "!get_tree().paused" if you really wanted to.
@yalaesutrigas605
@yalaesutrigas605 4 года назад
I also use my cat as a microphone. Thanks for all your content :)
@tin2001
@tin2001 4 года назад
Fun fact - that device is genuinely called a "dead cat"....
@souv1k985
@souv1k985 4 года назад
Your method was working flawlessly when I used visible=true under func _ready(). Before that the pause menu was always visible when the scene was loaded for the first time. Anyway great tut!
@link_nukem
@link_nukem 4 года назад
Hey, I am having the same problem could you go into more details on how you fixed it
@souv1k985
@souv1k985 4 года назад
@@link_nukem LOL I actually forgot how I did it. It was a long time ago and I am quite busy now, but, I can give you my github repo if that helps. Good Luck! github.com/souvikban16/firstgame. Its under /UI/pausemenu.gd
@link_nukem
@link_nukem 4 года назад
@@souv1k985 Thanks a lot
@tin2001
@tin2001 4 года назад
Well here was me thinking pausing would require dozens of steps and be something complicated... And it can be done with one line 😂
@hrn8935
@hrn8935 2 года назад
Thank you so much I've been trying so many different tutorials but this was simple and effective
@kohrakvaza
@kohrakvaza 4 года назад
Such a great and simple tutorial. Love it!
@metanoia038
@metanoia038 6 лет назад
hope you can do a tutorial for a lock/unlock level menu..
@GodofGrunts
@GodofGrunts 6 лет назад
What the heck that was easy lol
@sslaxx
@sslaxx 6 лет назад
It really is. The node processing feature makes it nice and (relatively) straightforward to code a "pause game" UI as well.
@rogerfalkevicz4596
@rogerfalkevicz4596 8 месяцев назад
How do i code when i pause the mouse is showing and when i despause the cursor is hide?
@TruongNguyenVan-jv4nb
@TruongNguyenVan-jv4nb 6 лет назад
I'd like to one word 'wonderful', thanks.
@gargoyled_drake
@gargoyled_drake 2 года назад
2021, this pauses but does not unpause.
@enigmatoons3622
@enigmatoons3622 3 года назад
Hello GDQest. This tutorial is great. However, I'd like to ask you: Is there a way in which I can only pause the HUD? I'm making a racing game and I want the HUD time to stop when the race finishes. I just don't know how. Could you help me please?
@Matseuu
@Matseuu 3 года назад
that would be easier with a boolean variable, so you can turn it on and off
@ZeeheeTheGreat
@ZeeheeTheGreat 3 года назад
Thanks for this I hope you do more of these that's why I subbed and thank you
@laurencebannister
@laurencebannister 6 лет назад
This is pure gold!
@darkhunter777
@darkhunter777 4 месяца назад
How hp text write to csene ?
@anantaanugrah4324
@anantaanugrah4324 3 года назад
wait that's was fast didn't expect to do that fast but thank you i will continue to make my game
@giantfrogstudios839
@giantfrogstudios839 Год назад
Why are subtitles not available?
@Chubbuluss
@Chubbuluss Год назад
Thanks for the help!
@unidentifiedperson1357
@unidentifiedperson1357 Год назад
how do i stop a function running in global? when i pause anyone receiving knockback will continue moving because the knockback function is in global.
@m.a.c.86
@m.a.c.86 2 месяца назад
lovely thanks!
@the-voidwalker
@the-voidwalker 4 года назад
Omg I watched like 100 tutorials and ur is that simple what
@BEANSBEANSBEANS404
@BEANSBEANSBEANS404 4 года назад
im trying to make it where if you pause the mouse becomes visible, as in the game it is hidden. so how to I write a set of code so that when paused, the mouse is visible for as long as it is paused?
@thunderclap9059
@thunderclap9059 4 года назад
to hide the mouse: Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) to show the mouse: Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) hope it helps! (sorry if i have bad english)
@jeremia1235
@jeremia1235 6 месяцев назад
hello GDQUEST, I can't find a function to deactivate the player's keys for a few seconds during a ko or a knock back. how to proceed please.
@ricardo130695
@ricardo130695 5 лет назад
Thank you so much :D
@edwoodcheng6990
@edwoodcheng6990 6 лет назад
Great, we need it!!
@israhina
@israhina 2 года назад
The tutorial is good but it would be great if you activate the subtitles to understand better. Esta bueno el tutorial pero seria genial que actives los subtítulos para entender mejor.
@bucherregaldomi9084
@bucherregaldomi9084 2 года назад
nusiai mari, con israhinita
@tvargentina
@tvargentina 4 года назад
En español está en el canal indie libre, en 3 minutos lo explica muy fácilmente.
@McDumDum
@McDumDum 11 месяцев назад
why aren't there auto captions???
@jogamasfaz8727
@jogamasfaz8727 5 лет назад
Tanks! You hepe me alot!
@rogerfalkevicz4596
@rogerfalkevicz4596 8 месяцев назад
Explain me this code
@campersand2
@campersand2 3 года назад
ummm why when i debug my project the pause menu is showed? The code is fine
@kurrisudarshanreddy
@kurrisudarshanreddy 6 лет назад
Hey but this doesn't seem to work on the below code yield(get_tree().create_timer(1), "timeout") as the yield function is running without respecting the tree pause. Is there any way to pause the yield function in GoDot. By the way all of your tutorials are outstanding :)
@ThatSommeS
@ThatSommeS 6 лет назад
I use Engine.time_scale = 0 and Engine.time_scale = 1 (or a greater number) for pausing my game, I believe this also stops timers. Not sure if this is a good way to pause the game..
@Gdquest
@Gdquest 6 лет назад
That's probably because the timer you create doesn't inherit the pause state from the tree. Just use another timer object that does or redesign your coroutine.
@michaelflaherty4310
@michaelflaherty4310 4 года назад
Jumping in here a year later with the solution I just found because I read this while trying to solve the same problem... Timers have a second parameter "pause_mode_process", which defaults to true. To make them stop during pause, you need to add false after the time, like this: yield(get_tree().create_timer(1, false), "timeout") I hope this helps someone!
@michaelludlow626
@michaelludlow626 2 года назад
@@Gdquest hi i followed your tutorial exactly but visible is not being recongnised
@tripik426
@tripik426 3 года назад
6:58 I really don't get how that thing with the variable works. Can anyone explain, please?
@paulosullivan3472
@paulosullivan3472 3 года назад
if your get_tree().paused is not paused then it means false, if it is paused it means true. By setting it as a variable first he sets up a false or true based on the opposite of the paused state. So if you click pause it goes to the code, sees that it is not paused (i.e. false) and sets the state of the variable to True, it then changes the paused state to true and the visibility of the pause screen to true. The opposite happens if you select the pause button when it is paused.
@jogamasfaz8727
@jogamasfaz8727 5 лет назад
I gave a shanel about godot in Brazil, and i would like learn how a can make online games in godot engine! Do you know about it?
@gamfluent1258
@gamfluent1258 2 года назад
Im having an issue where I am pausing the game but when I set it get_tree().paused = false, it still stays paused. Please help
@carlosag9570
@carlosag9570 2 года назад
godot docs says when get_tree().paused = true then _input and _input_event wont be called anymore. anyway, for me it worked changing the pause mode from inherit to process
@theboomboomking4935
@theboomboomking4935 4 года назад
I'm probably not going to get an answer but no harm is done if I ask it anyways: When I change a scene, the pausing doesn't work anymore; in addition to that, when I tried to create a pause menu scene and then put it in the Level 2 scene, it lost the centralized look and the color. Any solutions?
@thunderclap9059
@thunderclap9059 4 года назад
you need to create a scene for the control node only then import it into other scenes using the "instance a scene file as a node" button next to the add node button hope this helps! (sorry if i have bad english)
@makadi86
@makadi86 Год назад
can we pause only one node in the tree?
@McDumDum
@McDumDum 11 месяцев назад
All nodes in your tree will be paused unless you mark them as such via Process in the menu. He essentially makes it where your code will grab all of your nodes in your tree.
@adhityamarya6411
@adhityamarya6411 3 года назад
i just dont understand why you dont make a button at the end.
@MaskedRokho
@MaskedRokho 3 года назад
It works, but whenever I try to add buttons they are really big. Can anybody help?
@ZeeheeTheGreat
@ZeeheeTheGreat 3 года назад
Just make it small like mine and make it a child of the Control node (PauseNode)
@DarkStarRules
@DarkStarRules 4 года назад
Is there a way to do this in a 2D platformer? I want to be able to pause and have the colorrect follow my Camera2D.
@PleepusPlopus
@PleepusPlopus 4 года назад
You still do it the exact same way, I tried it and still worked. You can save it as a separate scene if you have multiple levels
@DarkStarRules
@DarkStarRules 4 года назад
@@PleepusPlopus I've been able to make the colorrect follow the player since posting that comment.
@PleepusPlopus
@PleepusPlopus 4 года назад
@@DarkStarRules Ah okay
@ladyvampire4979
@ladyvampire4979 4 года назад
i copied the exact code but everytime I get the same error E 0:00:04.579 event_get_action_status: Request for nonexistent InputMap action 'ui.pause'. Condition "!E" is true. Returned: false core/input_map.cpp:195 @ event_get_action_status() Pause.gd:4 @ _input()
@ladyvampire4979
@ladyvampire4979 4 года назад
i tried with pause first
@Gdquest
@Gdquest 4 года назад
@@ladyvampire4979 The error is telling you that the input action you're requesting, here "ui.pause", doesn't exist, and that's most likely because it's still undefined in your project. To add it, go to Project -> Project Settings -> Input Map tab, and enter "pause" in the Action bar. Press enter, navigate down the window to the action, and assign it some keys by clicking the "+" button next to it.
@ladyvampire4979
@ladyvampire4979 4 года назад
@@Gdquest huge thanks, it worked :)
@chelovek-jpeg
@chelovek-jpeg 3 года назад
wow, awesome
@mirazzle
@mirazzle 5 лет назад
Do i need those layers?
@tripik426
@tripik426 3 года назад
Yes, otherwise there might be things on top of your pause screen, which you obviously want to avoid. Unless it's an intentional game feature.
@billw.wonder6160
@billw.wonder6160 4 года назад
It dosen't work for exit
@chameguinhos2522
@chameguinhos2522 6 лет назад
criei um pequeno jogo na godot, mas ele não roda no meu smarthphone(android 4.0.2) :(
@henrique.campos
@henrique.campos 6 лет назад
Deve ser por cause do Open GL 3, espera a versão 3.1 sair e recompila, tenho quase certeza que vai funcionar, a não ser que você tenha usado shaders, aí eu não sei, mas é provável que sim.
@chameguinhos2522
@chameguinhos2522 6 лет назад
vlw brother, vou ficar ligado nisso
@Lucas-gg9yb
@Lucas-gg9yb 4 года назад
se você quer rodar seu jogo em qualquer celular, use o opengl 2.0, o 3 é pra sistemas mais modernos que isso.
@tinflint
@tinflint 3 года назад
i hit the full rect under layout and it doesnt change at all
@TheRealKaiProton
@TheRealKaiProton 2 года назад
Ive got similar, hitting Full Rect, and it vanishes off the screen, then the same with color Rect.. Godot V3.4.2
@classicguy7813
@classicguy7813 4 года назад
9 44 not works now
@Butter0Code
@Butter0Code Год назад
How do I create a resume button? Please
@rockmystyle
@rockmystyle 4 года назад
does not work...GD 3.2.1 Stable
@Khaled.Abbara
@Khaled.Abbara 4 года назад
Really
@anantaanugrah4324
@anantaanugrah4324 3 года назад
it worked for me
@Dianruakrhakakks
@Dianruakrhakakks Год назад
doesn't work, it just pauses the entire game and then can't unpause it
@soran2290
@soran2290 5 лет назад
Actívate the translation please
@xipcrafter
@xipcrafter 5 лет назад
it does not works
@lofiscide
@lofiscide 2 года назад
I hope he make it free o And open source
@JonBaldock
@JonBaldock Год назад
overly complicated
@zeke.mp3343
@zeke.mp3343 3 года назад
Bruh ads
@ubahni
@ubahni 4 года назад
amazing tutorial! it doesnt even work
@Gdquest
@Gdquest 4 года назад
It does! In Godot 3.0 probably, or whichever version this tutorial covered. The code may not work 1:1 in Godot 3.2, it's up to the viewer to find the functions that may have been renamed in this case.
@ubahni
@ubahni 4 года назад
@@Gdquest oh, well i was using 3.1
@josuereis6367
@josuereis6367 4 года назад
This is the first video in the history of youtube that I see without the possibility of activate automatic subtitles! Congratulations for your xenophobia! Lol
@andrmiw9
@andrmiw9 3 года назад
you probably watched not too many of them...
Далее
I Made My First Game in Godot in 3 Weeks...
26:21
Просмотров 396 тыс.
How to get skins for FREE? #standoff #skins #coins
00:34
Godot 4: Switching Levels Made Easy
15:59
Просмотров 22 тыс.
Godot Recipes: Animation States
10:31
Просмотров 107 тыс.
LEVEL UP Your Game Design Toolkit (Godot for Beginners)
23:30
How Games Make VFX (Demonstrated in Godot 4)
5:46
Просмотров 352 тыс.
How to make a Video Game - Godot Beginner Tutorial
1:17:12
Top Down 2D Shooting in Godot
18:33
Просмотров 85 тыс.
Tutorial: Pause Menu in Godot 4
18:09
Просмотров 21 тыс.