add flying cheat to scale upwards

This commit is contained in:
2026-03-25 13:29:53 -05:00
parent d22978cd79
commit 194432266a
3 changed files with 31 additions and 10 deletions

View File

@@ -21,6 +21,7 @@ var current_movement := MovementMode.Walking
var gravity: float = ProjectSettings.get_setting("physics/3d/default_gravity")
var move_speed: float = BASE_MOVE_SPEED
var target_height: float = BASE_HEIGHT
var flying := false
@onready var body_collision_shape: CollisionShape3D = $BodyCollisionShape
@onready var fps_camera: Camera3D = $FPSCamera
@@ -47,7 +48,7 @@ func _physics_process(delta: float) -> void:
target_height, CROUCH_TRANSITION_SPEED)
move_and_slide()
if is_on_floor() and Input.is_action_just_pressed("jump"):
if (is_on_floor() or flying) and Input.is_action_just_pressed("jump"):
velocity.y = JUMP_SPEED
func _input(event: InputEvent) -> void:
@@ -59,7 +60,11 @@ func _input(event: InputEvent) -> void:
-deg_to_rad(70), deg_to_rad(70))
func handle_movement(delta: float) -> void:
velocity.y += -gravity * delta
velocity.y += 0.0 if flying else -gravity * delta
if Input.is_action_just_pressed("_cheat_fly"):
flying = not flying
var input = Input.get_vector("strafe_left", "strafe_right",
"move_forward", "move_backward")