Hello!
I have an asteroid spawner that spawns RigidBody2D asteroids of varying sizes and when I shoot RigidBody2D projectiles at it they collide and interact in-game as you'd expect but when I try to trigger logic there is no output. This script is attached to each asteroid that spawns and have also tried the syntax "body_entered.connect(_on_body_entered)" -> Side question: what's the difference?
func _ready() -> void:
contact_monitor = true
#are both syntax correct and function the same?
#body_entered.connect(_on_body_entered)
connect("body_entered", _on_body_entered)
func _on_body_entered(body) -> void:
if body.is_in_group("laserProjectile"):
print("collided with laser projectile")
elif body.is_in_group("rocketProjectile"):
print("collided with rocket projectile")
elif body.is_in_group("minigunProjectile"):
print("collided with minigun projectile")