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

I don't know how to say it but I'm making a bullet hell game and I created GUI, but there's one problem. The bullets are covering the GUI. I don't really don't know how to ,,layer down" them. I mean, I just want GUI to cover them but don't destroy them. Also, I made those bullets in another scene than the enemy. Enemy is also in another scene but I put enemy scene in main scene ( actual gameplay scene ). I used preload() to load bullet scene and then instanced it.

In case this would be important, the code looks like this:

Enemy script:

const bullet_scene = preload("res://Assets/Stages/Normal/Stage1/Bullet.tscn")

...

var bullet = bullet_scene.instance()
get_tree().root.add_child(bullet)
bullet.position = s.global_position
bullet.rotation = s.global_rotation

Bullet script:

const speed = 100

func _process(delta):
    position += transform.x * speed * delta

 func _on_KillTimer_timeout():
     queue_free()

It's maybe a really basic question but I just started so..

Godot version 3.23
in Engine by (25 points)

1 Answer

+1 vote

You could use canvas layers for this. Generally it's recommended to have UI in separate canvas layer, as it also prevents effects such as canvas modulate to affect ui.
Add CanvasLayer node to your project, and move HUD into it.

Here you can see a bit more detailed description.

by (1,100 points)

It works! Thanks!

You're welcome :)
Don't forget to accept the answer.

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.