Added Comments

This commit is contained in:
ncusimano 2023-08-19 11:58:11 -06:00
parent 61cd28172c
commit f6931cf64f
2 changed files with 17 additions and 2 deletions

View File

@ -26,9 +26,12 @@ func _process(delta):
func _input(event): func _input(event):
# Handle the rotation of the camera using mouse movement. # Handle the rotation of the camera using mouse movement.
if event is InputEventMouseMotion: if event is InputEventMouseMotion:
# Side to side, first player object then player visuals.
rotate_y(deg_to_rad(-event.relative.x * horiz_sens)) rotate_y(deg_to_rad(-event.relative.x * horiz_sens))
playerVisuals.rotate_y(deg_to_rad(event.relative.x * horiz_sens)) playerVisuals.rotate_y(deg_to_rad(event.relative.x * horiz_sens))
playerCam.rotate_x(deg_to_rad(event.relative.y * vert_sens))
# Vertical camera rotation.
playerCam.rotate_x(deg_to_rad(-event.relative.y * vert_sens))
func _physics_process(delta): func _physics_process(delta):
# Add the gravity. # Add the gravity.

View File

@ -4,6 +4,8 @@ var rng = RandomNumberGenerator.new()
var spin_amount = 0 var spin_amount = 0
var spinning = false var spinning = false
var wait_time = 0 var wait_time = 0
var walking = false
var walk_dist = 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.
@ -27,7 +29,17 @@ func _process(delta):
task = "wait" task = "wait"
"walk": "walk":
pass if !walking:
walk_dist = rng.randi_range(0, 20)
walking = true
if walk_dist > 0:
# Small change to turn a little while walking.
var spin_chance = rng.randi_range(0, 10)
if spin_chance <= 1:
rotate_y(5)
"spin": "spin":
if !spinning: if !spinning: