Added Comments
This commit is contained in:
parent
61cd28172c
commit
f6931cf64f
|
@ -26,9 +26,12 @@ func _process(delta):
|
|||
func _input(event):
|
||||
# Handle the rotation of the camera using mouse movement.
|
||||
if event is InputEventMouseMotion:
|
||||
# Side to side, first player object then player visuals.
|
||||
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):
|
||||
# Add the gravity.
|
||||
|
|
|
@ -4,6 +4,8 @@ var rng = RandomNumberGenerator.new()
|
|||
var spin_amount = 0
|
||||
var spinning = false
|
||||
var wait_time = 0
|
||||
var walking = false
|
||||
var walk_dist = 0
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
|
@ -27,7 +29,17 @@ func _process(delta):
|
|||
task = "wait"
|
||||
|
||||
"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":
|
||||
if !spinning:
|
||||
|
|
Loading…
Reference in New Issue