SlimeoosOdyssey/godot/Models/slime.gd

17 lines
522 B
GDScript3
Raw Normal View History

2023-08-19 02:19:56 -06:00
extends Node3D
@onready var animation_state: AnimationNodeStateMachinePlayback = $AnimationTree.get("parameters/playback")
2023-08-19 21:21:54 -06:00
@export var colors: Array[Color]
2023-08-19 02:19:56 -06:00
2023-08-19 21:21:54 -06:00
func _ready():
var color = colors[randi() % colors.size()]
2023-08-19 21:58:05 -06:00
var mat = $Armature/Skeleton3D/Slime.get_active_material(3).duplicate()
$Armature/Skeleton3D/Slime.set_surface_override_material(3, mat)
2023-08-19 21:21:54 -06:00
$Armature/Skeleton3D/Slime.get_active_material(3).albedo_color = color
2023-08-19 02:19:56 -06:00
func walk():
animation_state.travel("Walk")
func idle():
animation_state.travel("Idle")