From 46556d864b9685c3b09a0038f5de83966fe7ff94 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Thu, 10 Aug 2023 11:48:05 +0200 Subject: Initial commit --- Scenes/Entities/Objects/Coin.gd | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Scenes/Entities/Objects/Coin.gd (limited to 'Scenes/Entities/Objects/Coin.gd') diff --git a/Scenes/Entities/Objects/Coin.gd b/Scenes/Entities/Objects/Coin.gd new file mode 100644 index 0000000..77fc6c2 --- /dev/null +++ b/Scenes/Entities/Objects/Coin.gd @@ -0,0 +1,16 @@ +extends StaticBody2D + + +func _ready(): + var collision_area = Utilities.Collision.Area.new(self, $CollisionShape2D, false) + collision_area.connect("collided", Callable(self, "_collide")) + add_child(collision_area) + + +func hit_by_explosion(): + queue_free() + + +func _collide(area: Area2D): + if area.is_in_group("player"): + queue_free() -- cgit v1.2.3