diff options
-rw-r--r-- | racing/lobby.gd | 3 | ||||
-rw-r--r-- | racing/player.gd | 19 |
2 files changed, 21 insertions, 1 deletions
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(): | |||
84 | 84 | ||
85 | if global.get_node_or_null("RaceManager") == null: | 85 | if global.get_node_or_null("RaceManager") == null: |
86 | installScriptExtension(ResourceLoader.load("user://maps/racing/load.gd")) | 86 | installScriptExtension(ResourceLoader.load("user://maps/racing/load.gd")) |
87 | installScriptExtension(ResourceLoader.load("user://maps/racing/player.gd")) | ||
87 | 88 | ||
88 | var race_manager_script = load("user://maps/racing/manager.gd") | 89 | var race_manager_script = load("user://maps/racing/manager.gd") |
89 | var race_manager = race_manager_script.new() | 90 | var race_manager = race_manager_script.new() |
@@ -414,7 +415,7 @@ func _start_game(): | |||
414 | Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) | 415 | Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) |
415 | global.map = "level1" | 416 | global.map = "level1" |
416 | global.entry_point = Vector3( | 417 | global.entry_point = Vector3( |
417 | race_manager.start_pos[1], race_manager.start_pos[2] + 0.25, race_manager.start_pos[3] | 418 | race_manager.start_pos[1], race_manager.start_pos[2] + 1, race_manager.start_pos[3] |
418 | ) | 419 | ) |
419 | global.entry_rotate = Vector3(0, 0, 0) | 420 | global.entry_rotate = Vector3(0, 0, 0) |
420 | global.sets_entry_point = true | 421 | 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 @@ | |||
1 | extends "res://scripts/player.gd" | ||
2 | |||
3 | |||
4 | func _unhandled_input(event): | ||
5 | ._unhandled_input(event) | ||
6 | |||
7 | # Checks specifically for *not* playable. On purpose. | ||
8 | if event is InputEventMouseMotion and !playable and !solving: | ||
9 | rotate_y(-event.relative.x * mouse_sensitivity) | ||
10 | if global.invert_y_axis: | ||
11 | pivot.rotate_x(event.relative.y * mouse_sensitivity) | ||
12 | else: | ||
13 | pivot.rotate_x(-event.relative.y * mouse_sensitivity) | ||
14 | pivot.rotation.x = clamp(pivot.rotation.x, -1.5, 1.5) | ||
15 | |||
16 | |||
17 | func _solving(): | ||
18 | if playable: | ||
19 | ._solving() | ||