This commit is contained in:
ncusimano 2023-08-19 11:17:09 -06:00
parent 5ca8491046
commit aa25e5c772
6 changed files with 45 additions and 1 deletions

View File

@ -1,5 +1,10 @@
extends Node3D extends Node3D
var rng = RandomNumberGenerator.new()
var spin_amount = 0
var spinning = false
var wait_time = 0
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
@ -8,4 +13,43 @@ func _ready():
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta): func _process(delta):
pass var task = "idle"
match task:
"idle":
task = rng.randi_range(0, 100)
if task <= 33:
task = "walk"
elif task > 33 and task <= 50:
task = "spin"
elif task > 50:
task = "wait"
"walk":
pass
"spin":
if !spinning:
var spin_amount = rng.randi_range(-360, 360)
spinning = true
if spin_amount > 0:
rotate_y(5)
spin_amount -= 5
elif spin_amount < 0:
rotate_y(-5)
spin_amount += 5
else:
task = "idle"
spinning = false
"wait":
# Idle Animation goes here!
wait_time += 1
if wait_time == 100:
task = "idle"
wait_time = 0