I have a scene that is instanced by a node (turret shooting bullets).
The bullet hierarchy is the following:
Area2D (script attached)
-CollisionShape2D
-Node2D
-ColorRect
The script attached to the Area2D is the following:
extends Area2D
var timeUntilDelete = 1
@export var col : Area2D
var velocity : Vector2
func _process(delta):
position += velocity * delta
if timeUntilDelete > 0:
timeUntilDelete -= delta
else:
queue_free()
pass
func _on_body_entered(body):
queue_free()
pass
Everything works, except for the collision. I have tried to follow some tutorials and refer to the 4.1 docs, which have not helped at all. I have the Area2D's body_entered signal attached to itself for the script.
How do I actually make this work?