This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Hi,

I am very new to using Godot and have encountered a problem. My tree structure consists of a level node, background, UI, and an inventory node. My thought process is that the level node works as a state machine that increments the level when it receives a level increment signal. This is working fine, in the signal handler I have the following

func _on_Player_level_completed():
    current_level += 1
    current_level = min(current_level, FINISHED)
    var current_level_node = $CurrentLevel
    remove_child(current_level_node)

    if current_level == SEARCHING:
        var next_level_resource = load("res://scenes/level/levels/ExploreLevel.tscn")
        var next_level = next_level_resource.instance()
        add_child(next_level)

This loads the level successfully but my problem is that buttons on the scene are not clickable. I have tried menu buttons, buttons and the button I am hoping to use, texture button. The texture button hover does not trigger and the buttons pressed signal cannot be triggered. My levels tree is below.

Another strange behavior I have observed is that sometimes it works when the game runs full screen. Making me think this is more of a project settings problem. I run i3 window manager on arch linux and I make the game's window float when testing as then it resizes to the screen size i want (480x320), as this game will be running on a specific target screen. When the game starts it starts in a full sized windows (see second image below), with stretch disabled and resizable checked.

I have put the game's code here. The button in question will appear about 15 seconds into the game.

level tree
non-floating game
floating game

in Engine by (12 points)

2 Answers

+1 vote

in World.tscn, can you try moving Level "above" the two CanvasLayers "ItemsUI" and "Inventory"?
Scene tree

Also, for those two CanvasLayer scenes, change the Layer property in the inspector to 0
enter image description here

I made a fork with the change here: https://github.com/e-e/bluetooth-beacon-game

by (1,663 points)

I also added a couple of other changes to Level.gd that might be necessary. The most important is setting the new level's name to "CurrentLevel". This way, next time you change level, the current level will still be referenceable by $CurrentLevel. Also, remove_child() just removes it from the tree. If you want to actually get rid of the node, you should use queue_free()

See https://github.com/alxhoff/bluetooth-beacon-game/pull/1/files#diff-1ca2beac51f2edfbfbbe35b1c19e8d61

0 votes

Check the Mouse Filter option under your Control Node. If it is set to "Stop", it will block all inputs from passing through it. You can set it to "Ignore" if you want it completely allow all inputs to pass through it. The 3rd option "Pass", I'm still learning about, but the other two I was able to use to get my Pause and Game Over menus clickable again.

by (14 points)
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.