Save changes

This commit is contained in:
Gary Steven Keough 2024-12-15 00:35:49 -05:00
parent aaaa8a80a5
commit b475589f00
5 changed files with 17 additions and 23 deletions

View File

@ -7,12 +7,12 @@
[node name="DevLevel" type="Node3D"]
[node name="level" parent="." instance=ExtResource("3_vcq2f")]
[node name="Player" parent="." instance=ExtResource("2_q510b")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.46532, 9.08969, 5.43659)
joystick_camera_sens_multiplier = 5.0
[node name="level" parent="." instance=ExtResource("3_vcq2f")]
[node name="ShuttleClass" parent="." instance=ExtResource("3_lsckv")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 8.4922, 0)

View File

@ -119,16 +119,14 @@ func _jump(delta: float) -> Vector3:
func player_entered_ship(ship_global_position: Vector3, ship: Ship):
current_ship = ship
print(ship.ship_id)
print(global_position)
print("player entered ship: ", ship.ship_id)
func player_exited_ship(ship_global_position: Vector3, ship: Ship):
current_ship = null
print(ship.ship_id)
print(global_position)
print("player exited ship: ", ship.ship_id)
func set_is_piloting(state: bool):
is_piloting = state
GameConsole.log_debug("player pilot state" + str(is_piloting))
print("player is piloting: ", str(is_piloting))

View File

@ -11,6 +11,7 @@ var piloting_player: Player = null
var ship_id: int = 0
var ship_is_piloted: bool = false
var current_level
@export_range(0.01, 1.0, 0.01) var base_turn_speed: float = 0.3
@export var max_turn_speed: float = 0.5
@export_range(0.01, 1.0, 0.01) var base_lift_speed: float = 2.0
@ -18,7 +19,6 @@ var ship_is_piloted: bool = false
@export var move_speed: float = 10.0
@export var acceleration: float = 10.0
@export var deceleration: float = 20.0
var player_on_ship: bool = false
func _ready():
@ -28,7 +28,6 @@ func _ready():
_add_ship_helm(ship_helm_scene) #TEMPORARY TEST
ship_id = randi_range(1000, 9999) #assign a random id to the ship as a unique identifier
GameConsole.log_debug("Ship ID: " + str(ship_id))
@ -49,7 +48,7 @@ func _physics_process(delta):
elif Input.is_action_pressed("crouch"):
linear_velocity.y -= lift_speed
if player_on_ship:
if Input.is_action_pressed("move_forwards"):
var forward_force = (((-transform.basis.z * move_speed) - linear_velocity) * mass).normalized()
apply_central_force(forward_force)
@ -67,12 +66,11 @@ func _physics_process(delta):
func _on_area_3d_body_entered(body):
if body is Player:
print(self.name)
#print(self.name)
body.player_entered_ship(global_position, self)
piloting_player = body
if !player_on_ship:
body.reparent(self, true)
player_on_ship = true
func _on_area_3d_body_exited(body):
@ -80,9 +78,7 @@ func _on_area_3d_body_exited(body):
body.player_exited_ship(global_position, self)
ship_is_piloted = false
piloting_player = null
if player_on_ship:
body.reparent(get_node("/root/DevLevel/"), true)
player_on_ship = false
body.reparent(owner, true)
func _add_ship_helm(_ship_helm_scene: PackedScene):

Binary file not shown.