Added coin

This commit is contained in:
2024-05-10 20:47:43 +01:00
parent 1489d93ae6
commit d88f8a07fe
67 changed files with 1292 additions and 0 deletions

22
Coin/Coin.gd Normal file
View File

@@ -0,0 +1,22 @@
extends RigidBody2D
class_name Coin
signal coin_collected()
func _ready() -> void:
linear_velocity = Vector2(0, 40)
func set_upgrade(_chr : String, color : Color) -> void:
$Polygon2D.color = color
func _on_body_entered(body: Node) -> void:
if body is Floor:
get_parent().call_deferred("remove_child", self)
call_deferred("queue_free")
return
if body is Paddle:
coin_collected.emit()
get_parent().call_deferred("remove_child", self)
call_deferred("queue_free")