19 lines
273 B
GDScript3
19 lines
273 B
GDScript3
|
|
extends StaticBody3D
|
||
|
|
class_name TheCube
|
||
|
|
|
||
|
|
@export var max_life : int = 50
|
||
|
|
var health : int = max_life :
|
||
|
|
set(value):
|
||
|
|
health = value
|
||
|
|
if health <= 0:
|
||
|
|
death()
|
||
|
|
|
||
|
|
|
||
|
|
func take_damage(damage : int) -> void:
|
||
|
|
health -= damage
|
||
|
|
print(health)
|
||
|
|
|
||
|
|
|
||
|
|
func death():
|
||
|
|
print("GAME OVER")
|