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("explode") self.queue_free() func _process(delta: float) -> void: pass func _on_body_entered(body: Node) -> void: print("collision with grenade") if body.is_in_group("destructable"): body.queue_free() explode()