open-strike-2/scenes/maps/csg_box_3d.gd

24 lines
557 B
GDScript3
Raw Normal View History

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()