2025-10-28 01:02:15 +00:00
|
|
|
class_name Coin
|
|
|
|
|
extends Area2D
|
|
|
|
|
|
|
|
|
|
signal coin_collected(body, coin)
|
|
|
|
|
|
|
|
|
|
func _on_body_entered(body: Node2D) -> void:
|
|
|
|
|
print_debug("body connected with coin")
|
|
|
|
|
if body is Player:
|
|
|
|
|
coin_collected.emit(body, self)
|
2025-11-04 01:56:43 +00:00
|
|
|
if body is Grenade:
|
|
|
|
|
self.visible = false
|
|
|
|
|
body.explode()
|
|
|
|
|
await body.animated_sprite_2d.animation_finished
|
|
|
|
|
self.queue_free()
|