SeptemberGameAB/scripts/coin.gd

15 lines
339 B
GDScript3
Raw Permalink Normal View History

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)
if body is Grenade:
self.visible = false
body.explode()
await body.animated_sprite_2d.animation_finished
self.queue_free()