game: add hp pickup
This commit is contained in:
14
scenes/pickups/pickup_hp.gd
Normal file
14
scenes/pickups/pickup_hp.gd
Normal file
@@ -0,0 +1,14 @@
|
||||
class_name PickupHP
|
||||
extends PickupBase
|
||||
|
||||
@export var value: float = 25.0
|
||||
|
||||
@onready var collision_shape_2d: CollisionShape2D = $Area2D/CollisionShape2D
|
||||
|
||||
|
||||
func pickup() -> void:
|
||||
if not player:
|
||||
push_error("pickup called on %s without player set" % self)
|
||||
return
|
||||
player.take_damage(-value)
|
||||
queue_free()
|
Reference in New Issue
Block a user