save changes

This commit is contained in:
Gary Steven Keough 2024-12-14 22:54:22 -05:00
parent a04478b516
commit aec842980e
2 changed files with 37 additions and 9 deletions

View File

@ -34,7 +34,7 @@ volumetric_fog_density = 0.0
[node name="CustomSkies" type="WorldEnvironment"] [node name="CustomSkies" type="WorldEnvironment"]
environment = SubResource("Environment_8p04f") environment = SubResource("Environment_8p04f")
script = ExtResource("2_unvmv") script = ExtResource("2_unvmv")
rateOfTime = 500.0 rateOfTime = 100.0
skyRotation = 18.5 skyRotation = 18.5
[node name="SunMoonLine" type="Node3D" parent="."] [node name="SunMoonLine" type="Node3D" parent="."]
@ -52,5 +52,6 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -5)
[node name="MoonDirectionalLight3D" type="DirectionalLight3D" parent="SunMoonLine/MoonNodes"] [node name="MoonDirectionalLight3D" type="DirectionalLight3D" parent="SunMoonLine/MoonNodes"]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0) transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
light_energy = 0.01 light_energy = 0.05
light_angular_distance = 1.0
shadow_enabled = true shadow_enabled = true

View File

@ -11,12 +11,13 @@ var piloting_player: Player = null
var ship_id: int = 0 var ship_id: int = 0
var ship_is_piloted: bool = false var ship_is_piloted: bool = false
var turn_speed: float = 10.0 @export_range(0.01, 1.0, 0.01) var base_turn_speed: float = 0.3
var lift_speed: float = 10.0 @export var max_turn_speed: float = 0.5
var top_speed: float = 10.0 @export_range(0.01, 1.0, 0.01) var base_lift_speed: float = 2.0
var move_speed: float = 10.0 @export var top_speed: float = 5.0
var acceleration: float = 10.0 @export var move_speed: float = 10.0
var deceleration: float = 20.0 @export var acceleration: float = 10.0
@export var deceleration: float = 20.0
func _ready(): func _ready():
@ -33,7 +34,33 @@ func _ready():
func _physics_process(delta): func _physics_process(delta):
if ship_is_piloted: if ship_is_piloted:
pass var turn_speed = base_turn_speed / max(mass, 1)
var lift_speed = base_lift_speed / max(mass, 1)
if Input.is_action_pressed("move_left"):
angular_velocity.y += turn_speed
elif Input.is_action_pressed("move_right"):
angular_velocity.y -= turn_speed
else:
global_rotation.z = lerpf(global_rotation.z, 0, 0.8)
if Input.is_action_pressed("jump"):
linear_velocity.y += lift_speed
elif Input.is_action_pressed("crouch"):
linear_velocity.y -= lift_speed
if Input.is_action_pressed("move_forwards"):
var forward_force = (((-transform.basis.z * move_speed) - linear_velocity) * mass).normalized()
apply_central_force(forward_force)
elif Input.is_action_pressed("move_backwards"):
var forward_force = (((transform.basis.z * move_speed) - linear_velocity) * mass).normalized()
apply_central_force(forward_force)
angular_velocity.y = clamp(angular_velocity.y, -max_turn_speed, max_turn_speed)
# Self level slowly
global_rotation.x = lerpf(global_rotation.x, 0, 0.1)
global_rotation.z = lerpf(global_rotation.z, 0, 0.1)
func _on_area_3d_body_entered(body): func _on_area_3d_body_entered(body):