Challenge - Deleting Unwanted Nodes

The challenge requires to remove unwanted nodes. In the course the unwanted nodes are the rockets while I have used the laser as nodes that I want to remove.

In the laser script I have added the following piece of code:

## Reference node
@onready var _visible_notifier = get_node("VisibleNotifier")

func _ready():
	# Connect the signal to the method
	_visible_notifier.connect("screen_exited", _on_laser_out)

## Removes the laser when is out of the screen.
func _on_laser_out():
	self.queue_free()

Instead of adding the signal through the editor I have connected directly to through the code with the _ready function.

Final result
out

1 Like

Privacy & Terms