commit 1ccf324f45dab8fefe89357f9d45c919286fd152
parent 1eeaf8550ac04fca9fa94fdfa0e2f33424ed87d7
Author: FIGBERT <figbert@figbert.com>
Date: Tue, 24 Nov 2020 00:27:27 -0800
Move speed into a speed const
Diffstat:
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/scripts/Character.gd b/scripts/Character.gd
@@ -1,6 +1,7 @@
extends KinematicBody
var velocity = Vector3(0,0,0)
+const SPEED = 6
func _ready():
pass
@@ -12,9 +13,9 @@ func _physics_process(delta):
):
velocity.x = 0
elif Input.is_action_pressed("ui_right"):
- velocity.x = 5
+ velocity.x = SPEED
elif Input.is_action_pressed("ui_left"):
- velocity.x = -5
+ velocity.x = -SPEED
else:
velocity.x = lerp(velocity.x, 0, 0.1)
@@ -24,9 +25,9 @@ func _physics_process(delta):
):
velocity.z = 0
elif Input.is_action_pressed("ui_up"):
- velocity.z = -5
+ velocity.z = -SPEED
elif Input.is_action_pressed("ui_down"):
- velocity.z = 5
+ velocity.z = SPEED
else:
velocity.z = lerp(velocity.z, 0, 0.1)
move_and_slide(velocity)