24 lines
557 B
GDScript
24 lines
557 B
GDScript
extends CSGBox3D
|
|
|
|
var health = 5
|
|
|
|
@export var color: Color = Color(0, 0, 0)
|
|
|
|
var colors = [Color(1.0, 0.0, 0.0, 1.0),
|
|
Color(0.0, 1.0, 0.0, 1.0),
|
|
Color(0.0, 0.0, 1.0, 0.0)]
|
|
|
|
func take_damage():
|
|
color = Color(randf(), randf(), randf())
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready() -> void:
|
|
pass # Replace with function body.
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta: float) -> void:
|
|
material_override.albedo_color = color
|
|
if health < 1:
|
|
queue_free()
|