Godot Version: 4.2.2
I’m creating a very simple block that i intend for it to fade after a certain amount of time. The problem is that the block doesn’t disappear with queue_free(). This is the basic code:
func _on_body_entered(body):
if body.name == “Player”:
print(“Hello”)
self.queue_free()
To note: it does print Hello as intended, but it doesn’t disappear, no idea why. Any ideas? Thanks!
If you leave and go back in does it print "Hello"
again?
Seems like maybe the Texture/Sprite for the block is seperate from the Area2D
. So you’re just deleting the Area2D
but not the Texture/Sprite that represents it?
Not much to go off based on the limited information.
I dont remember you having to use self for the queue free (or that’s how it’s done in the case I’m not sure) Try just doing queue_free() on it’s own or show us a demonstration
you can’t end the main scene with queue_free().
queue_free() is intended for removing unused resources after you’re done displaying them. if the script is only in the main scene then you have to target the square with square.queue_free()
but you must also target the object in the tree with something like “var square = $MeshInstance3D”
if you want. you can try that whole “bullet” tutorial. i got the same project going on after the tutorial. free to use. there’s no help files. just keyboard arrows and enter/esc https://github.com/GiongGone/direction_fighter.git
Go to debug in the upper tabs and set true the collision shape visible, then experiment yourself why it’s happening, also see the player name is really “Player”? When running the project, minimize it, you will find a option “remote” in the scene tree (you can only find the remote option when the project is running), so inspect the player, all is will?