How to make GUI cover bullets

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By NeiPodam

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()
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():

It’s maybe a really basic question but I just started so…

:bust_in_silhouette: Reply From: aXu_AP

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.

It works! Thanks!

NeiPodam | 2021-10-20 20:49

You’re welcome :slight_smile:
Don’t forget to accept the answer.

aXu_AP | 2021-10-21 05:42