Updates
This commit is contained in:
		
							parent
							
								
									5ca8491046
								
							
						
					
					
						commit
						aa25e5c772
					
				
					 6 changed files with 45 additions and 1 deletions
				
			
		
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -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
 | 
			
		||||
		
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue