sfrem/prototype-floor (#8)
This PR creates the floor and adds a couple of things along with it. Note that this floor is not exactly "playable". You can walk around and you're inside of a big empty space with a glass at the top, but there's nothing to do inside of it, and the lighting could use a lot of work. Getting this in now so that more work can be done to it. View from inside the tower: <img width="1475" alt="image.png" src="attachments/56ab5066-2d8e-4137-93ee-9aebfcfe6ada"> Closes #3 Reviewed-on: #8 Reviewed-by: indigoso <indigosowhat@gmail.com> Co-authored-by: godsfryingpan <sfrembling@gmail.com> Co-committed-by: godsfryingpan <sfrembling@gmail.com>
This commit was merged in pull request #8.
This commit is contained in:
@@ -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")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user