diff options
author | mikatomik <mikec_2007@hotmail.com> | 2022-09-11 23:41:29 -0400 |
---|---|---|
committer | mikatomik <mikec_2007@hotmail.com> | 2022-09-15 01:21:21 -0400 |
commit | dff4ca391185726dcc96215fb0ce157ecda032fa (patch) | |
tree | 0df05064b71597c016bdb909d35a78b82de686de /character | |
parent | 134440ace62915ebab3b2e1252ab33ccff467c40 (diff) | |
download | godot_wildjam_49-dff4ca391185726dcc96215fb0ce157ecda032fa.tar.gz godot_wildjam_49-dff4ca391185726dcc96215fb0ce157ecda032fa.zip |
Begin ship development. Blendfiles added
Diffstat (limited to 'character')
-rw-r--r-- | character/fps_controller/fps_controller.gd | 14 |
1 files changed, 13 insertions, 1 deletions
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 |