diff --git a/godot/Models/grape_animations/idle.res b/godot/Models/grape_animations/idle.res index 17a3689..2a3799d 100644 Binary files a/godot/Models/grape_animations/idle.res and b/godot/Models/grape_animations/idle.res differ diff --git a/godot/Models/grape_animations/pickup.res b/godot/Models/grape_animations/pickup.res index f70358d..3c6ff9d 100644 Binary files a/godot/Models/grape_animations/pickup.res and b/godot/Models/grape_animations/pickup.res differ diff --git a/godot/Models/grape_animations/upper_body_holding.res b/godot/Models/grape_animations/upper_body_holding.res index 76c3a46..c813dab 100644 Binary files a/godot/Models/grape_animations/upper_body_holding.res and b/godot/Models/grape_animations/upper_body_holding.res differ diff --git a/godot/Models/grape_animations/upper_body_idle.res.res b/godot/Models/grape_animations/upper_body_idle.res.res index 4be43ab..1148b98 100644 Binary files a/godot/Models/grape_animations/upper_body_idle.res.res and b/godot/Models/grape_animations/upper_body_idle.res.res differ diff --git a/godot/Models/grape_animations/walk.res b/godot/Models/grape_animations/walk.res index bd24642..5cb5329 100644 Binary files a/godot/Models/grape_animations/walk.res and b/godot/Models/grape_animations/walk.res differ diff --git a/godot/Villager.gd b/godot/Villager.gd index 92626b9..91a9960 100644 --- a/godot/Villager.gd +++ b/godot/Villager.gd @@ -1,5 +1,10 @@ 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. func _ready(): @@ -8,4 +13,43 @@ func _ready(): # Called every frame. 'delta' is the elapsed time since the previous frame. 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 + + +