extends Area2D ## Собираемая монета. При контакте с Fox — начисляет очки и исчезает. const POINTS: int = 100 func _ready() -> void: collision_layer = 2 collision_mask = 1 body_entered.connect(_on_body_entered) func _on_body_entered(body: Node) -> void: if body.is_class("CharacterBody2D"): if body.has_method("hit_coin"): body.hit_coin(POINTS) _collect() func _collect() -> void: var tween := create_tween() tween.tween_property(self, "scale", Vector2(0.1, 0.1), 0.15) tween.tween_property(self, "modulate:a", 0.0, 0.15) await tween.finished queue_free()