SlimeoosOdyssey/godot/Models/slime.gd

17 lines
522 B
GDScript

extends Node3D
@onready var animation_state: AnimationNodeStateMachinePlayback = $AnimationTree.get("parameters/playback")
@export var colors: Array[Color]
func _ready():
var color = colors[randi() % colors.size()]
var mat = $Armature/Skeleton3D/Slime.get_active_material(3).duplicate()
$Armature/Skeleton3D/Slime.set_surface_override_material(3, mat)
$Armature/Skeleton3D/Slime.get_active_material(3).albedo_color = color
func walk():
animation_state.travel("Walk")
func idle():
animation_state.travel("Idle")