0 votes

Can someone Please help

I'm trying to check if a window dialog is hidden because when I press the left mouse button("shoot") it plays the shooting sound but if I press the left mouse button inside a window dialog it still make the shoot sound which I dont want.

here is my current code:

func _process(delta):

if Input.isactionjust_pressed("shoot"):

if how do i check to see if the window dialog is hidden and if so proceed

getnode("Armature/Skeleton/weaponsm4auto01").play()

in Engine by (26 points)

1 Answer

+1 vote
Best answer

Hi Tyrei.

To achieve that result, you could use the is_visible() method, which is a method common to all canvas items.
So, the condition you wish to write might look like this:

if !my_dialog.is_visible():
    getnode("Armature/Skeleton/weaponsm4auto01").play()

Obviosuly you have to substitue "my_dialog" with your dialog node.

To know more about what is possible to do with canvasItems such as PopupDialogs, you could read the documentation. It is well written and quite easy to understand.
Here are the links:
CanvasItem
PopupDialog

by (77 points)
selected by
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 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 webmaster@godotengine.org with your username.