0 votes

Hey there,

I am wondering if it is possible to create a scene (which includes for example a skill tree with functional scripting already included) which gets loaded as a overlay (which works) to the current scene/game.

I do not know if background loading is the correct thing for this.

Underneath I structured my idea:

-Main Game
--Kinematic Body (Player)
---Skilltree scene/hud
---Backpack scene/hud
----Currency window, crafting reagents window
---Character attribute scene/hud
----Main attributes
----Secondary attributes

in Engine by (30 points)

Have you looked into putting the overlay scene together with Control nodes, and then adding that scene as an instance to the character's scene? All of this can be done in the Godot editor, BTW. Once those have been designed and added, the overlay can be used with directly accessing the attached scripts from the root node, or using signals.

Have not looked inside of this yet as I do not have an idea which function/scene methods could be valueable for it.

I used by main game scene and try to add the scene with character's attribute to it with a keyboard input and it is currently not working with that method. The general scene instancing (loading scene in _ready function) is working.

The debugger shows, that the child process itself get's connected. Any suggestions? I found a similiar problem: https://www.reddit.com/r/godot/comments/5jubro/how_do_i_spawnsummon_a_node_object_through/

Maingame.gd

extends Node2D
var Charakterwerte = load("res://Scenes/Interface/Charakterwerte.tscn")
var Charakterwerte_Instance = Charakterwerte.instance()

func Tastatur(event):
    if event is InputEventKey:
        if event.pressed and event.scancode == KEY_SPACE:
            Charakterwerte_Instance.set_name("Charakterwerte")
            add_child(Charakterwerte_Instance)

I tried to move the variables into the function without success.

func Tastatur(event):
            if event is InputEventKey:
    if event.pressed and event.scancode == KEY_SPACE:
        var Charakterwerte = load("res://Scenes/Interface/Charakterwerte.tscn")
        var Charakterwerte_Instance = Charakterwerte.instance()
        Charakterwerte_Instance.set_name("Charakterwerte")
        add_child(Charakterwerte_Instance)

If you didn't know, some Control nodes are set to consume input by default (e.g. some don't allow mouse clicks to propagate). For mouse clicks, look for mouse filtering in the Inspector for each Control node.

Have you looked into using the _gui_input() function to handle Control related code? That function handles GUI stuff before any player inputs (more information on that input can be found here).

Please log in or register to answer this question.

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.