0 votes

hello guys I have a probelm on my pause menu. I'm beginner on english and making game. so acually Im trying different something, my pause menu working like this (I wanna work like this):

extends Node2D 
var abd = 0 

func _process(delta):
if Input.is_action_just_pressed("Pause") : 
            abd = 1
            if abd == 1:
                $Control.visible = true
                get_tree().paused = true
                abd -= 0
            elif abd == 0:
                get_tree().paused = false
                abd -= 1

elif part is not important for now I was think there but I forget. İf you want u can tell me

and this code aim:
visible = true (this my pause menu)
get_tree().pause (and this is will stop game)
ım using "var" cause this code part is Global.
and I wanna work resume button.
my resume button codies like that:

extends Button

func _process(delta):
    if PalyerGlobal.abd == 1:
        get_tree().paused = false
    pass # Replace with function body.

func _on_Button_pressed():
    $"../../../..".visible = false
    PalyerGlobal.abd = 0
    pass # Replace with function body.

if you didnt understand me my Discord GM#8081 u can find me from there and we can talk on discord I can show u my screen (godot :))
thank for your help and care have nice day !!

Godot version godot engine v3.5.1.stable.mono.official
in Engine by (14 points)

1 Answer

+1 vote

My guess is you havent set the pause mode on your pause menu. If you look in the editor you will see there is a "pause" function and it is probably set to inherit. You need to change this to "process" on your pause menu items. Then they should continue to process even after you pause the program.

by (3,103 points)

I had done but this wasn't work

Okay try changing the code in your pause menu to this

func _process(delta):
    if Input.is_action_just_pressed("Pause") : 
        get_tree().paused = false
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.