From 2ce58f86aa74f1fd904690cb3ba3438bee4b765f Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Thu, 8 Feb 2024 21:49:04 -0500 Subject: start spin, not in ground --- racing/lobby.gd | 3 ++- racing/player.gd | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 racing/player.gd diff --git a/racing/lobby.gd b/racing/lobby.gd index 10fefb6..38402de 100644 --- a/racing/lobby.gd +++ b/racing/lobby.gd @@ -84,6 +84,7 @@ func _ready(): if global.get_node_or_null("RaceManager") == null: installScriptExtension(ResourceLoader.load("user://maps/racing/load.gd")) + installScriptExtension(ResourceLoader.load("user://maps/racing/player.gd")) var race_manager_script = load("user://maps/racing/manager.gd") var race_manager = race_manager_script.new() @@ -414,7 +415,7 @@ func _start_game(): Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) global.map = "level1" global.entry_point = Vector3( - race_manager.start_pos[1], race_manager.start_pos[2] + 0.25, race_manager.start_pos[3] + race_manager.start_pos[1], race_manager.start_pos[2] + 1, race_manager.start_pos[3] ) global.entry_rotate = Vector3(0, 0, 0) global.sets_entry_point = true diff --git a/racing/player.gd b/racing/player.gd new file mode 100644 index 0000000..95220c1 --- /dev/null +++ b/racing/player.gd @@ -0,0 +1,19 @@ +extends "res://scripts/player.gd" + + +func _unhandled_input(event): + ._unhandled_input(event) + + # Checks specifically for *not* playable. On purpose. + if event is InputEventMouseMotion and !playable and !solving: + rotate_y(-event.relative.x * mouse_sensitivity) + if global.invert_y_axis: + pivot.rotate_x(event.relative.y * mouse_sensitivity) + else: + pivot.rotate_x(-event.relative.y * mouse_sensitivity) + pivot.rotation.x = clamp(pivot.rotation.x, -1.5, 1.5) + + +func _solving(): + if playable: + ._solving() -- cgit 1.4.1