ball now more consistently collides with arbitrary objects and bounces off them appropriately
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
extends Sprite2D
|
||||
class_name Block
|
||||
|
||||
@export var health: int = 1
|
||||
|
||||
func _ready():
|
||||
_update_text()
|
||||
|
||||
func _update_text():
|
||||
$Label.text = "%s" % health
|
||||
|
||||
func take_damage(damage):
|
||||
health -= damage
|
||||
_update_text()
|
||||
if health < 0:
|
||||
die()
|
||||
|
||||
func die():
|
||||
self.queue_free()
|
||||
Reference in New Issue
Block a user