diff --git a/player/player.gd b/player/player.gd index 79d1fae..98a81e3 100644 --- a/player/player.gd +++ b/player/player.gd @@ -71,21 +71,24 @@ func _physics_process(delta): # Get the input direction and handle the movement/deceleration. if Input.is_action_pressed("ui_strafe"): input_dir = Input.get_vector("ui_right", "ui_left", "ui_down", "ui_up") - else: # if not Input.is_action_pressed( "ui_strafe" ): + else: var y = 0 - if Input.is_action_pressed("ui_right") and not Input.is_action_pressed("ui_strafe_right"): - y -= 1 - if Input.is_action_pressed("ui_left") and not Input.is_action_pressed("ui_strafe_left"): - y += 1 - if y != 0: - var dt = y * delta * speed_rotate_1sec - camera_rotate_y += dt - if camera_rotate_y > PI: - camera_rotate_y -= TWO_PI - elif camera_rotate_y <= -PI: - camera_rotate_y += TWO_PI - $camera_root/horizontal_root.rotate_y( dt ) - input_dir = Input.get_vector("ui_strafe_right", "ui_strafe_left", "ui_down", "ui_up") + if Input.is_action_pressed("ui_strafe_right") or Input.is_action_pressed("ui_strafe_left"): + input_dir = Input.get_vector("ui_strafe_right", "ui_strafe_left", "ui_down", "ui_up") + else: + if Input.is_action_pressed("ui_right"): + y -= 1 + if Input.is_action_pressed("ui_left"): + y += 1 + if y != 0: + var dt = y * delta * speed_rotate_1sec + camera_rotate_y += dt + if camera_rotate_y > PI: + camera_rotate_y -= TWO_PI + elif camera_rotate_y <= -PI: + camera_rotate_y += TWO_PI + $camera_root/horizontal_root.rotate_y( dt ) + input_dir = Input.get_vector("nothing", "nothing", "ui_down", "ui_up") var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized() if direction: @@ -97,6 +100,7 @@ func _physics_process(delta): move_and_slide() + func _process( delta ): if debug: print(reconciliate_rotate_camer_player, ", ", camera_rotate_y,", ", player_rotate_y)