0 votes

If you open up the 2d Platformer template project (a great help for getting started on a game, btw), it's got a lot of great examples of game components, including some UI elements.
I had a question regarding one of the components, though. In the main Game node, as a child of the InterfaceLayer (a CanvasLayer node), there is a Control node called PauseMenu. In the Game.gd script, there is a portion that listens for a pause command (the escape key press), and at that point, there is a line that says:


I cannot find anywhere that documents this Open function. According to the docs, Control doesn't have this as a member. As I've been trying to translate the scripts in the 2dplatformer template to C# (for my own enjoyment), I'm unable to find a corresponding function.

does anyone know where this function comes from, or what Node it's meant to go with? I'm assuming there may be some dynamic typing going on for this that I'm missing.

in Engine by (41 points)

1 Answer

+1 vote
Best answer

I just took a look at the source. The PauseMenu node is just a Control (as you correctly noted). If you look at the script attached to the node itself (PauseMenu.gd - where the _pause_menu.open() code lives), you'll see that open is just a local script function containing this code:

func open():
    visible = true

So, it just sets the control's visibility state and focus...

by (13,674 points)
selected by

oh, yes. Thank you for that!

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.