class_name grenade extends RigidBody2D var timer = Timer.new() func _ready() -> void: add_child(timer) timer.wait_time = 2 timer.one_shot = true timer.connect("timeout", explode) timer.start() func explode()->void: print("boom boom") self.queue_free() func _on_body_entered(body: Node) -> void: print("the grenade collision works") if body.is_in_group("fragile"): body.queue_free() explode()