From dff4ca391185726dcc96215fb0ce157ecda032fa Mon Sep 17 00:00:00 2001 From: mikatomik Date: Sun, 11 Sep 2022 23:41:29 -0400 Subject: Begin ship development. Blendfiles added --- character/fps_controller/fps_controller.gd | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'character') diff --git a/character/fps_controller/fps_controller.gd b/character/fps_controller/fps_controller.gd index 3021d40..e2d4d03 100644 --- a/character/fps_controller/fps_controller.gd +++ b/character/fps_controller/fps_controller.gd @@ -7,9 +7,18 @@ export var walk_speed : int = 5 export var accel : float = 0.2 export var gravity : int = -1 export var term_velocity : int = -35 +export var jump_strength : int = 10 var velocity : Vector3 +var state = WALKING + +enum { + WALKING, + SPRINTING, +} + + func _ready(): Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) @@ -18,6 +27,7 @@ func _process(_delta): func _physics_process(_delta): handle_movement() + handle_jumping() func get_input(): var dir : Vector3 = Vector3.ZERO @@ -55,4 +65,6 @@ func _input(event): camera.rotate_x(-event.relative.y * Settings.mouse_sens) camera.rotation.x = clamp(camera.rotation.x, -1.2, 1.2) - +func handle_jumping(): + if Input.is_action_just_pressed("jump") and is_on_floor(): + velocity.y = jump_strength -- cgit v1.2.3