Compare commits
19 Commits
Author | SHA1 | Date |
---|---|---|
Ensar Sarajčić | de0f97c7e0 | |
Ensar Sarajčić | bfe2ac2672 | |
Ensar Sarajčić | a0f9d7a65e | |
Ensar Sarajčić | a2b61b0193 | |
Ensar Sarajčić | 7289cf4b09 | |
Ensar Sarajčić | bcb0647926 | |
Ensar Sarajčić | d6ec1c407b | |
Ensar Sarajčić | 4a8c32b2c3 | |
Ensar Sarajčić | 2df1e29640 | |
Ensar Sarajčić | de0a8111d1 | |
Ensar Sarajčić | 0b0e12d230 | |
Ensar Sarajčić | 8f8e17d606 | |
Ensar Sarajčić | 40d49200f4 | |
Ensar Sarajčić | 48db95478c | |
Ensar Sarajčić | 873325fbe4 | |
Ensar Sarajčić | 0a71908bc9 | |
Ensar Sarajčić | af62cdbafe | |
Ensar Sarajčić | 23152bfbba | |
Ensar Sarajčić | 61b7139aa8 |
18
README.md
18
README.md
|
@ -12,3 +12,21 @@ Game is available on [Itch.io](https://esensar.itch.io/bugged-racing).
|
|||
|
||||
Game source code is licensed under [MIT license](/LICENSE).
|
||||
Assets are licensed under [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/).
|
||||
|
||||
## Credits
|
||||
|
||||
This game includes assets from [opengameart.org](opengameart.org), [freesound.org](freesound.org) and other sources.
|
||||
|
||||
### Sounds
|
||||
|
||||
#### Wind sounds
|
||||
|
||||
[Wind sounds](/assets/wind%20woosh%20loop.ogg) used in the game is available on [opengameart.org](https://opengameart.org/content/wind-whoosh-loop) under CC0 license (public domain).
|
||||
|
||||
#### Engine sounds
|
||||
|
||||
[Engine sounds](/assets/engine.wav) used in the game is available on [freesound.org](https://freesound.org/people/MarlonHJ/sounds/242740/) under CC0 license (public domain).
|
||||
|
||||
#### Tire sounds
|
||||
|
||||
[Tire sounds](/assets/tires_squal_loop.wav) used in the game is available on [opengameart.org](https://opengameart.org/content/car-tire-squeal-skid-loop) under [CC-BY 3.0 license](https://creativecommons.org/licenses/by/3.0/). Sound is provided by [audible-edge (Tom Haigh)](http://www.freesound.org/people/audible-edge/) and submitted by [qubodup](https://opengameart.org/users/qubodup)
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,21 @@
|
|||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamSample"
|
||||
path="res://.import/engine.wav-cc4df8df683a7f5419ef7019228b045a.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/engine.wav"
|
||||
dest_files=[ "res://.import/engine.wav-cc4df8df683a7f5419ef7019228b045a.sample" ]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop=true
|
||||
compress/mode=0
|
Binary file not shown.
|
@ -0,0 +1,21 @@
|
|||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamSample"
|
||||
path="res://.import/tires_squal_loop.wav-6f4aaa09ee4bdf0eca94aed4cc79779d.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/tires_squal_loop.wav"
|
||||
dest_files=[ "res://.import/tires_squal_loop.wav-6f4aaa09ee4bdf0eca94aed4cc79779d.sample" ]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop=true
|
||||
compress/mode=0
|
Binary file not shown.
|
@ -0,0 +1,15 @@
|
|||
[remap]
|
||||
|
||||
importer="ogg_vorbis"
|
||||
type="AudioStreamOGGVorbis"
|
||||
path="res://.import/wind woosh loop.ogg-843e7b8cdfc6f4a378e2da0a4cb7290b.oggstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/wind woosh loop.ogg"
|
||||
dest_files=[ "res://.import/wind woosh loop.ogg-843e7b8cdfc6f4a378e2da0a4cb7290b.oggstr" ]
|
||||
|
||||
[params]
|
||||
|
||||
loop=true
|
||||
loop_offset=0
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"version": {
|
||||
"major": 0,
|
||||
"minor": 2,
|
||||
"patch": 2
|
||||
"minor": 3,
|
||||
"patch": 0
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ scroll_horizontal_enabled = false
|
|||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/ScrollContainer"]
|
||||
margin_right = 800.0
|
||||
margin_bottom = 1974.0
|
||||
margin_bottom = 2300.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Title" type="Label" parent="MarginContainer/ScrollContainer/VBoxContainer"]
|
||||
|
@ -139,20 +139,78 @@ __meta__ = {
|
|||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Label7" type="Label" parent="MarginContainer/ScrollContainer/VBoxContainer"]
|
||||
[node name="Label17" type="Label" parent="MarginContainer/ScrollContainer/VBoxContainer"]
|
||||
margin_top = 490.0
|
||||
margin_right = 800.0
|
||||
margin_bottom = 508.0
|
||||
custom_fonts/font = SubResource( 2 )
|
||||
text = "Credits:"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Label20" type="Label" parent="MarginContainer/ScrollContainer/VBoxContainer"]
|
||||
margin_top = 516.0
|
||||
margin_right = 800.0
|
||||
margin_bottom = 534.0
|
||||
custom_fonts/font = SubResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Label23" type="RichTextLabel" parent="MarginContainer/ScrollContainer/VBoxContainer"]
|
||||
margin_top = 542.0
|
||||
margin_right = 800.0
|
||||
margin_bottom = 782.0
|
||||
size_flags_vertical = 0
|
||||
custom_fonts/normal_font = SubResource( 2 )
|
||||
bbcode_enabled = true
|
||||
bbcode_text = "This game includes assets from [url=https://opengameart.org]opengameart.org[/url], [url=https://freesound.org]freesound.org[/url] and other sources.
|
||||
|
||||
- Sounds:
|
||||
|
||||
Wind sound used in the game is available on [url=https://opengameart.org/content/wind-whoosh-loop]opengameart.org[/url] under CC0 license (public domain).
|
||||
|
||||
Engine sound used in the game is available on [url=https://freesound.org/people/MarlonHJ/sounds/242740/]freesound.org[/url] under CC0 license (public domain).
|
||||
|
||||
Tire sound used in the game is available on [url=https://opengameart.org/content/car-tire-squeal-skid-loop]opengameart.org[/url] under [url=https://creativecommons.org/licenses/by/3.0/]CC-BY 3.0 license[/url]. Sound is provided by [url=http://www.freesound.org/people/audible-edge/]audible-edge (Tom Haigh)[/url] and submitted by [url=https://opengameart.org/users/qubodup]qubodup[/url]"
|
||||
text = "This game includes assets from opengameart.org, freesound.org and other sources.
|
||||
|
||||
- Sounds:
|
||||
|
||||
Wind sound used in the game is available on opengameart.org under CC0 license (public domain).
|
||||
|
||||
Engine sound used in the game is available on freesound.org under CC0 license (public domain).
|
||||
|
||||
Tire sound used in the game is available on opengameart.org under CC-BY 3.0 license. Sound is provided by audible-edge (Tom Haigh) and submitted by qubodup"
|
||||
fit_content_height = true
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Label21" type="Label" parent="MarginContainer/ScrollContainer/VBoxContainer"]
|
||||
margin_top = 790.0
|
||||
margin_right = 800.0
|
||||
margin_bottom = 808.0
|
||||
custom_fonts/font = SubResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Label7" type="Label" parent="MarginContainer/ScrollContainer/VBoxContainer"]
|
||||
margin_top = 816.0
|
||||
margin_right = 800.0
|
||||
margin_bottom = 834.0
|
||||
custom_fonts/font = SubResource( 2 )
|
||||
text = "Open source licences:"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Label8" type="Label" parent="MarginContainer/ScrollContainer/VBoxContainer"]
|
||||
margin_top = 516.0
|
||||
margin_top = 842.0
|
||||
margin_right = 800.0
|
||||
margin_bottom = 534.0
|
||||
margin_bottom = 860.0
|
||||
custom_fonts/font = SubResource( 2 )
|
||||
align = 1
|
||||
__meta__ = {
|
||||
|
@ -160,9 +218,9 @@ __meta__ = {
|
|||
}
|
||||
|
||||
[node name="Label11" type="RichTextLabel" parent="MarginContainer/ScrollContainer/VBoxContainer"]
|
||||
margin_top = 542.0
|
||||
margin_top = 868.0
|
||||
margin_right = 800.0
|
||||
margin_bottom = 562.0
|
||||
margin_bottom = 888.0
|
||||
custom_fonts/normal_font = SubResource( 2 )
|
||||
bbcode_enabled = true
|
||||
bbcode_text = "Godot Engine (also available in [url=https://godotengine.org/license]web version[/url]):"
|
||||
|
@ -170,9 +228,9 @@ text = "Godot Engine (also available in web version):"
|
|||
fit_content_height = true
|
||||
|
||||
[node name="Label9" type="Label" parent="MarginContainer/ScrollContainer/VBoxContainer"]
|
||||
margin_top = 570.0
|
||||
margin_top = 896.0
|
||||
margin_right = 800.0
|
||||
margin_bottom = 1092.0
|
||||
margin_bottom = 1418.0
|
||||
custom_fonts/font = SubResource( 2 )
|
||||
text = "
|
||||
This game uses Godot Engine, available under the following license:
|
||||
|
@ -190,9 +248,9 @@ __meta__ = {
|
|||
}
|
||||
|
||||
[node name="Label12" type="Label" parent="MarginContainer/ScrollContainer/VBoxContainer"]
|
||||
margin_top = 1100.0
|
||||
margin_top = 1426.0
|
||||
margin_right = 800.0
|
||||
margin_bottom = 1118.0
|
||||
margin_bottom = 1444.0
|
||||
custom_fonts/font = SubResource( 2 )
|
||||
align = 1
|
||||
__meta__ = {
|
||||
|
@ -200,9 +258,9 @@ __meta__ = {
|
|||
}
|
||||
|
||||
[node name="Label10" type="RichTextLabel" parent="MarginContainer/ScrollContainer/VBoxContainer"]
|
||||
margin_top = 1126.0
|
||||
margin_top = 1452.0
|
||||
margin_right = 800.0
|
||||
margin_bottom = 1206.0
|
||||
margin_bottom = 1532.0
|
||||
custom_fonts/normal_font = SubResource( 2 )
|
||||
bbcode_enabled = true
|
||||
bbcode_text = "[url=https://www.freetype.org/]FreeType[/url]:
|
||||
|
@ -214,9 +272,9 @@ text = "FreeType:
|
|||
fit_content_height = true
|
||||
|
||||
[node name="Label13" type="Label" parent="MarginContainer/ScrollContainer/VBoxContainer"]
|
||||
margin_top = 1214.0
|
||||
margin_top = 1540.0
|
||||
margin_right = 800.0
|
||||
margin_bottom = 1232.0
|
||||
margin_bottom = 1558.0
|
||||
custom_fonts/font = SubResource( 2 )
|
||||
align = 1
|
||||
__meta__ = {
|
||||
|
@ -224,9 +282,9 @@ __meta__ = {
|
|||
}
|
||||
|
||||
[node name="Label14" type="RichTextLabel" parent="MarginContainer/ScrollContainer/VBoxContainer"]
|
||||
margin_top = 1240.0
|
||||
margin_top = 1566.0
|
||||
margin_right = 800.0
|
||||
margin_bottom = 1660.0
|
||||
margin_bottom = 1986.0
|
||||
custom_fonts/normal_font = SubResource( 2 )
|
||||
bbcode_enabled = true
|
||||
bbcode_text = "[url=http://enet.bespin.org/]ENet[/url]:
|
||||
|
@ -252,9 +310,9 @@ text = "ENet:
|
|||
fit_content_height = true
|
||||
|
||||
[node name="Label15" type="Label" parent="MarginContainer/ScrollContainer/VBoxContainer"]
|
||||
margin_top = 1668.0
|
||||
margin_top = 1994.0
|
||||
margin_right = 800.0
|
||||
margin_bottom = 1686.0
|
||||
margin_bottom = 2012.0
|
||||
custom_fonts/font = SubResource( 2 )
|
||||
align = 1
|
||||
__meta__ = {
|
||||
|
@ -262,9 +320,9 @@ __meta__ = {
|
|||
}
|
||||
|
||||
[node name="Label16" type="RichTextLabel" parent="MarginContainer/ScrollContainer/VBoxContainer"]
|
||||
margin_top = 1694.0
|
||||
margin_top = 2020.0
|
||||
margin_right = 800.0
|
||||
margin_bottom = 1974.0
|
||||
margin_bottom = 2300.0
|
||||
custom_fonts/normal_font = SubResource( 2 )
|
||||
bbcode_enabled = true
|
||||
bbcode_text = "[url=https://tls.mbed.org/]MBedTLS[/url]:
|
||||
|
@ -293,6 +351,7 @@ fit_content_height = true
|
|||
[connection signal="meta_clicked" from="MarginContainer/ScrollContainer/VBoxContainer/Label3" to="." method="_on_link_meta_clicked"]
|
||||
[connection signal="meta_clicked" from="MarginContainer/ScrollContainer/VBoxContainer/Label19" to="." method="_on_link_meta_clicked"]
|
||||
[connection signal="meta_clicked" from="MarginContainer/ScrollContainer/VBoxContainer/Label18" to="." method="_on_link_meta_clicked"]
|
||||
[connection signal="meta_clicked" from="MarginContainer/ScrollContainer/VBoxContainer/Label23" to="." method="_on_link_meta_clicked"]
|
||||
[connection signal="meta_clicked" from="MarginContainer/ScrollContainer/VBoxContainer/Label11" to="." method="_on_link_meta_clicked"]
|
||||
[connection signal="meta_clicked" from="MarginContainer/ScrollContainer/VBoxContainer/Label10" to="." method="_on_link_meta_clicked"]
|
||||
[connection signal="meta_clicked" from="MarginContainer/ScrollContainer/VBoxContainer/Label14" to="." method="_on_link_meta_clicked"]
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
extends Spatial
|
||||
|
||||
const CAMERA_CONTROLLER = preload("res://player/cameras/camera_controller.gd")
|
||||
|
||||
var vehicle_path = "res://vehicles/buggy.tscn"
|
||||
var camera_controller: CameraController
|
||||
var vehicle: Node = null
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
reset()
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if Input.is_action_just_released("next_camera"):
|
||||
camera_controller.next_camera()
|
||||
|
||||
camera_controller.update_camera(
|
||||
(
|
||||
Input.get_action_strength("turn_camera_right")
|
||||
- Input.get_action_strength("turn_camera_left")
|
||||
),
|
||||
Input.get_action_strength("turn_camera_up") - Input.get_action_strength("turn_camera_down"),
|
||||
Input.is_action_pressed("look_backwards")
|
||||
)
|
||||
|
||||
|
||||
func change_vehicle_to(new_vehicle_path: String) -> void:
|
||||
vehicle_path = new_vehicle_path
|
||||
reset()
|
||||
|
||||
|
||||
func reset() -> void:
|
||||
if vehicle != null:
|
||||
vehicle.queue_free()
|
||||
camera_controller.clear()
|
||||
|
||||
vehicle = load(vehicle_path).instance()
|
||||
add_child(vehicle)
|
||||
camera_controller = CAMERA_CONTROLLER.new()
|
||||
camera_controller.attach_cameras_to(vehicle)
|
|
@ -0,0 +1,237 @@
|
|||
[gd_scene load_steps=8 format=2]
|
||||
|
||||
[ext_resource path="res://icon.png" type="Texture" id=1]
|
||||
[ext_resource path="res://menu/camera_config_scene.gd" type="Script" id=2]
|
||||
|
||||
[sub_resource type="PlaneMesh" id=1]
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=2]
|
||||
albedo_texture = ExtResource( 1 )
|
||||
|
||||
[sub_resource type="ConcavePolygonShape" id=3]
|
||||
data = PoolVector3Array( 1, 0, 1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0, -1, 1, 0, -1 )
|
||||
|
||||
[sub_resource type="CylinderMesh" id=4]
|
||||
height = 15.0
|
||||
|
||||
[sub_resource type="ConvexPolygonShape" id=5]
|
||||
points = PoolVector3Array( -1, -7.5, 0, -0.995301, -7.5, -0.0980814, -0.995301, -7.5, 0.0978857, -1, 7.5, 0, -0.980814, -7.5, -0.195184, -0.995301, 7.5, -0.0980814, -0.980814, -7.5, 0.194988, -0.995301, 7.5, 0.0978857, -0.957126, -7.5, -0.290329, -0.980814, 7.5, -0.195184, -0.957126, -7.5, 0.290133, -0.980814, 7.5, 0.194988, -0.924041, -7.5, -0.382733, -0.957126, 7.5, -0.290329, -0.924041, -7.5, 0.382537, -0.957126, 7.5, 0.290133, -0.88195, -7.5, -0.471417, -0.924041, 7.5, -0.382733, -0.88195, -7.5, 0.471222, -0.924041, 7.5, 0.382537, -0.831637, -7.5, -0.555599, -0.88195, 7.5, -0.471417, -0.831637, -7.5, 0.555403, -0.88195, 7.5, 0.471222, -0.773101, -7.5, -0.634495, -0.831637, 7.5, -0.555599, -0.773101, -7.5, 0.634299, -0.831637, 7.5, 0.555403, -0.707126, -7.5, -0.707126, -0.773101, 7.5, -0.634495, -0.707126, -7.5, 0.70693, -0.773101, 7.5, 0.634299, -0.634495, -7.5, -0.773101, -0.707126, 7.5, -0.707126, -0.634495, -7.5, 0.772905, -0.707126, 7.5, 0.70693, -0.555599, -7.5, -0.831637, -0.634495, 7.5, -0.773101, -0.555599, -7.5, 0.831441, -0.634495, 7.5, 0.772905, -0.471417, -7.5, -0.88195, -0.555599, 7.5, -0.831637, -0.471417, -7.5, 0.881754, -0.555599, 7.5, 0.831441, -0.382733, -7.5, -0.924041, -0.471417, 7.5, -0.88195, -0.382733, -7.5, 0.923845, -0.471417, 7.5, 0.881754, -0.290329, -7.5, -0.957126, -0.382733, 7.5, -0.924041, -0.290329, -7.5, 0.95693, -0.382733, 7.5, 0.923845, -0.195184, -7.5, -0.980814, -0.290329, 7.5, -0.957126, -0.195184, -7.5, 0.980619, -0.290329, 7.5, 0.95693, -0.0980814, -7.5, -0.995301, -0.195184, 7.5, -0.980814, -0.0980814, -7.5, 0.995106, -0.195184, 7.5, 0.980619, 0, -7.5, -1, -0.0980814, 7.5, -0.995301, 0, -7.5, 1, -0.0980814, 7.5, 0.995106, 0.0978857, -7.5, -0.995301, 0, 7.5, -1, 0.0978857, -7.5, 0.995106, 0, 7.5, 1, 0.194988, -7.5, -0.980814, 0.0978857, 7.5, -0.995301, 0.194988, -7.5, 0.980619, 0.0978857, 7.5, 0.995106, 0.290133, -7.5, -0.957126, 0.194988, 7.5, -0.980814, 0.290133, -7.5, 0.95693, 0.194988, 7.5, 0.980619, 0.382537, -7.5, -0.924041, 0.290133, 7.5, -0.957126, 0.382537, -7.5, 0.923845, 0.290133, 7.5, 0.95693, 0.471222, -7.5, -0.88195, 0.382537, 7.5, -0.924041, 0.471222, -7.5, 0.881754, 0.382537, 7.5, 0.923845, 0.555403, -7.5, -0.831637, 0.471222, 7.5, -0.88195, 0.555403, -7.5, 0.831441, 0.471222, 7.5, 0.881754, 0.634299, -7.5, -0.773101, 0.555403, 7.5, -0.831637, 0.634299, -7.5, 0.772905, 0.555403, 7.5, 0.831441, 0.70693, -7.5, -0.707126, 0.634299, 7.5, -0.773101, 0.70693, -7.5, 0.70693, 0.634299, 7.5, 0.772905, 0.772905, -7.5, -0.634495, 0.70693, 7.5, -0.707126, 0.772905, -7.5, 0.634299, 0.70693, 7.5, 0.70693, 0.831441, -7.5, -0.555599, 0.772905, 7.5, -0.634495, 0.831441, -7.5, 0.555403, 0.772905, 7.5, 0.634299, 0.881754, -7.5, -0.471417, 0.831441, 7.5, -0.555599, 0.881754, -7.5, 0.471222, 0.831441, 7.5, 0.555403, 0.923845, -7.5, -0.382733, 0.881754, 7.5, -0.471417, 0.923845, -7.5, 0.382537, 0.881754, 7.5, 0.471222, 0.95693, -7.5, -0.290329, 0.923845, 7.5, -0.382733, 0.95693, -7.5, 0.290133, 0.923845, 7.5, 0.382537, 0.980619, -7.5, -0.195184, 0.95693, 7.5, -0.290329, 0.980619, -7.5, 0.194988, 0.95693, 7.5, 0.290133, 0.995106, -7.5, -0.0980814, 0.980619, 7.5, -0.195184, 0.995106, -7.5, 0.0978857, 0.980619, 7.5, 0.194988, 1, -7.5, 0, 0.995106, 7.5, -0.0980814, 0.995106, 7.5, 0.0978857, 1, 7.5, 0 )
|
||||
|
||||
[node name="Spatial" type="Spatial"]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="StaticBody" type="StaticBody" parent="."]
|
||||
transform = Transform( 99.9785, 0, 0, 0, 99.9785, 0, 0, 0, 99.9785, 0, 0, 0 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="StaticBody"]
|
||||
transform = Transform( 6.13726, 0, 0, 0, 6.13726, 0, 0, 0, 6.13726, 0, 0, 0 )
|
||||
mesh = SubResource( 1 )
|
||||
material/0 = SubResource( 2 )
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="StaticBody"]
|
||||
transform = Transform( 6.13726, 0, 0, 0, 6.13726, 0, 0, 0, 6.13726, 0, 0, 0 )
|
||||
shape = SubResource( 3 )
|
||||
|
||||
[node name="StaticBody48" type="StaticBody" parent="."]
|
||||
transform = Transform( 0.375559, 0, 0, 0, -1.64162e-08, 1, 0, -0.375559, -4.37114e-08, -31.0595, 4.33657, 9.2691 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="StaticBody48"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
mesh = SubResource( 4 )
|
||||
material/0 = null
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="StaticBody48"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
shape = SubResource( 5 )
|
||||
|
||||
[node name="StaticBody49" type="StaticBody" parent="."]
|
||||
transform = Transform( 0.375559, 0, 0, 0, -1.64162e-08, 1, 0, -0.375559, -4.37114e-08, -22.0595, 4.33657, 9.2691 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="StaticBody49"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
mesh = SubResource( 4 )
|
||||
material/0 = null
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="StaticBody49"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
shape = SubResource( 5 )
|
||||
|
||||
[node name="StaticBody50" type="StaticBody" parent="."]
|
||||
transform = Transform( 0.375559, 0, 0, 0, -1.64162e-08, 1, 0, -0.375559, -4.37114e-08, -13.0595, 4.33657, 9.2691 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="StaticBody50"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
mesh = SubResource( 4 )
|
||||
material/0 = null
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="StaticBody50"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
shape = SubResource( 5 )
|
||||
|
||||
[node name="StaticBody51" type="StaticBody" parent="."]
|
||||
transform = Transform( 0.375559, 0, 0, 0, -1.64162e-08, 1, 0, -0.375559, -4.37114e-08, -5.05947, 4.33657, 9.2691 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="StaticBody51"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
mesh = SubResource( 4 )
|
||||
material/0 = null
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="StaticBody51"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
shape = SubResource( 5 )
|
||||
|
||||
[node name="StaticBody52" type="StaticBody" parent="."]
|
||||
transform = Transform( 0.375559, 0, 0, 0, -1.64162e-08, 1, 0, -0.375559, -4.37114e-08, 2.94053, 4.33657, 9.2691 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="StaticBody52"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
mesh = SubResource( 4 )
|
||||
material/0 = null
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="StaticBody52"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
shape = SubResource( 5 )
|
||||
|
||||
[node name="StaticBody53" type="StaticBody" parent="."]
|
||||
transform = Transform( 0.375559, 0, 0, 0, -1.64162e-08, 1, 0, -0.375559, -4.37114e-08, 13.9405, 4.33657, 9.2691 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="StaticBody53"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
mesh = SubResource( 4 )
|
||||
material/0 = null
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="StaticBody53"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
shape = SubResource( 5 )
|
||||
|
||||
[node name="StaticBody54" type="StaticBody" parent="."]
|
||||
transform = Transform( 0.375559, 0, 0, 0, -1.64162e-08, 1, 0, -0.375559, -4.37114e-08, 24.9405, 4.33657, 9.2691 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="StaticBody54"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
mesh = SubResource( 4 )
|
||||
material/0 = null
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="StaticBody54"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
shape = SubResource( 5 )
|
||||
|
||||
[node name="StaticBody55" type="StaticBody" parent="."]
|
||||
transform = Transform( 0.375559, 0, 0, 0, -1.64162e-08, 1, 0, -0.375559, -4.37114e-08, 34.9405, 4.33657, 9.2691 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="StaticBody55"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
mesh = SubResource( 4 )
|
||||
material/0 = null
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="StaticBody55"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
shape = SubResource( 5 )
|
||||
|
||||
[node name="StaticBody56" type="StaticBody" parent="."]
|
||||
transform = Transform( 0.375559, 0, 0, 0, -1.64162e-08, 1, 0, -0.375559, -4.37114e-08, 34.9405, 4.33657, -8.7309 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="StaticBody56"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
mesh = SubResource( 4 )
|
||||
material/0 = null
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="StaticBody56"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
shape = SubResource( 5 )
|
||||
|
||||
[node name="StaticBody57" type="StaticBody" parent="."]
|
||||
transform = Transform( 0.375559, 0, 0, 0, -1.64162e-08, 1, 0, -0.375559, -4.37114e-08, 30.9405, 4.33657, -8.7309 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="StaticBody57"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
mesh = SubResource( 4 )
|
||||
material/0 = null
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="StaticBody57"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
shape = SubResource( 5 )
|
||||
|
||||
[node name="StaticBody58" type="StaticBody" parent="."]
|
||||
transform = Transform( 0.375559, 0, 0, 0, -1.64162e-08, 1, 0, -0.375559, -4.37114e-08, 25.9405, 4.33657, -8.7309 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="StaticBody58"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
mesh = SubResource( 4 )
|
||||
material/0 = null
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="StaticBody58"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
shape = SubResource( 5 )
|
||||
|
||||
[node name="StaticBody59" type="StaticBody" parent="."]
|
||||
transform = Transform( 0.375559, 0, 0, 0, -1.64162e-08, 1, 0, -0.375559, -4.37114e-08, 20.9405, 4.33657, -8.7309 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="StaticBody59"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
mesh = SubResource( 4 )
|
||||
material/0 = null
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="StaticBody59"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
shape = SubResource( 5 )
|
||||
|
||||
[node name="StaticBody60" type="StaticBody" parent="."]
|
||||
transform = Transform( 0.375559, 0, 0, 0, -1.64162e-08, 1, 0, -0.375559, -4.37114e-08, 13.9405, 4.33657, -8.7309 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="StaticBody60"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
mesh = SubResource( 4 )
|
||||
material/0 = null
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="StaticBody60"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
shape = SubResource( 5 )
|
||||
|
||||
[node name="StaticBody61" type="StaticBody" parent="."]
|
||||
transform = Transform( 0.375559, 0, 0, 0, -1.64162e-08, 1, 0, -0.375559, -4.37114e-08, 6.94053, 4.33657, -8.7309 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="StaticBody61"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
mesh = SubResource( 4 )
|
||||
material/0 = null
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="StaticBody61"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
shape = SubResource( 5 )
|
||||
|
||||
[node name="StaticBody62" type="StaticBody" parent="."]
|
||||
transform = Transform( 0.375559, 0, 0, 0, -1.64162e-08, 1, 0, -0.375559, -4.37114e-08, -4.05947, 4.33657, -8.7309 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="StaticBody62"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
mesh = SubResource( 4 )
|
||||
material/0 = null
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="StaticBody62"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
shape = SubResource( 5 )
|
||||
|
||||
[node name="StaticBody63" type="StaticBody" parent="."]
|
||||
transform = Transform( 0.375559, 0, 0, 0, -1.64162e-08, 1, 0, -0.375559, -4.37114e-08, -20.0595, 4.33657, -8.7309 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="StaticBody63"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
mesh = SubResource( 4 )
|
||||
material/0 = null
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="StaticBody63"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
shape = SubResource( 5 )
|
||||
|
||||
[node name="StaticBody64" type="StaticBody" parent="."]
|
||||
transform = Transform( 0.375559, 0, 0, 0, -1.64162e-08, 1, 0, -0.375559, -4.37114e-08, -20.0595, 4.33657, -8.7309 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="StaticBody64"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
mesh = SubResource( 4 )
|
||||
material/0 = null
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="StaticBody64"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.417043, 0 )
|
||||
shape = SubResource( 5 )
|
|
@ -19,7 +19,7 @@ func _on_MultiplayerButton_pressed() -> void:
|
|||
|
||||
|
||||
func _on_ExitButton_pressed() -> void:
|
||||
get_tree().quit()
|
||||
get_tree().notification(MainLoop.NOTIFICATION_WM_QUIT_REQUEST)
|
||||
|
||||
|
||||
func _on_SettingsButton_pressed() -> void:
|
||||
|
|
|
@ -1,25 +1,71 @@
|
|||
extends Panel
|
||||
|
||||
const PLAYER_CONTROLLER = preload("res://player/vehicle_controller.gd")
|
||||
const CAMERA_TEST_SCENE = preload("res://menu/camera_config_scene.tscn")
|
||||
|
||||
const BUGGY = "res://vehicles/buggy.tscn"
|
||||
const BEETLE = "res://vehicles/beetlecar.tscn"
|
||||
const BUGMOBILE = "res://vehicles/bugmobile.tscn"
|
||||
|
||||
var vehicles = [BEETLE, BUGGY, BUGMOBILE]
|
||||
|
||||
var inputs = BuggedVehicle.VehicleInputs.new()
|
||||
|
||||
onready var master_bus := AudioServer.get_bus_index("Master")
|
||||
onready var sound_bus := AudioServer.get_bus_index("Sound")
|
||||
onready var music_bus := AudioServer.get_bus_index("Music")
|
||||
|
||||
# gdlint: ignore=max-line-length
|
||||
onready var master_slider: HSlider = $MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/MasterSlider
|
||||
onready var master_slider: HSlider = $MarginContainer/VSplitContainer/TabContainer/Audio/Audio/MasterSlider
|
||||
# gdlint: ignore=max-line-length
|
||||
onready var sound_slider: HSlider = $MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/SoundEffectsSlider
|
||||
onready var sound_slider: HSlider = $MarginContainer/VSplitContainer/TabContainer/Audio/Audio/SoundEffectsSlider
|
||||
# gdlint: ignore=max-line-length
|
||||
onready var music_slider: HSlider = $MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/MusicSlider
|
||||
onready var music_slider: HSlider = $MarginContainer/VSplitContainer/TabContainer/Audio/Audio/MusicSlider
|
||||
# gdlint: ignore=max-line-length
|
||||
onready var auto_clutch_cb: CheckBox = $MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/AutoClutchCheckBox
|
||||
onready var auto_clutch_cb: CheckBox = $MarginContainer/VSplitContainer/TabContainer/Controls/Controls/AutoClutchCheckBox
|
||||
# gdlint: ignore=max-line-length
|
||||
onready var automatic_transmission_cb: CheckBox = $MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/AutomaticTransmissionCheckBox
|
||||
onready var automatic_transmission_cb: CheckBox = $MarginContainer/VSplitContainer/TabContainer/Controls/Controls/AutomaticTransmissionCheckBox
|
||||
# gdlint: ignore=max-line-length
|
||||
onready var fullscreen_cb: CheckBox = $MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/FullscreenCheckBox
|
||||
onready var fullscreen_cb: CheckBox = $MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/System/FullscreenCheckBox
|
||||
# gdlint: ignore=max-line-length
|
||||
onready var borderless_cb: CheckBox = $MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/BorderlessCheckBox
|
||||
onready var borderless_cb: CheckBox = $MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/System/BorderlessCheckBox
|
||||
# gdlint: ignore=max-line-length
|
||||
onready var multiplayer_name_box: LineEdit = $MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/MultiplayerNameBox
|
||||
onready var multiplayer_name_box: LineEdit = $MarginContainer/VSplitContainer/TabContainer/Gameplay/Gameplay/MultiplayerNameBox
|
||||
# gdlint: ignore=max-line-length
|
||||
onready var steering_sensitivity_slider: HSlider = $MarginContainer/VSplitContainer/TabContainer/Controls/Controls/SteeringSensitivitySlider
|
||||
# gdlint: ignore=max-line-length
|
||||
onready var steering_return_speed_slider: HSlider = $MarginContainer/VSplitContainer/TabContainer/Controls/Controls/SteeringReturnSpeedSlider
|
||||
# gdlint: ignore=max-line-length
|
||||
onready var steering_deadzone_inner_slider: HSlider = $MarginContainer/VSplitContainer/TabContainer/Controls/Controls/SteeringInnerDeadzoneSlider
|
||||
# gdlint: ignore=max-line-length
|
||||
onready var steering_deadzone_outer_slider: HSlider = $MarginContainer/VSplitContainer/TabContainer/Controls/Controls/SteeringOuterDeadzoneSlider
|
||||
# gdlint: ignore=max-line-length
|
||||
onready var throttle_sensitivity_slider: HSlider = $MarginContainer/VSplitContainer/TabContainer/Controls/Controls/ThrottleSensitivitySlider
|
||||
# gdlint: ignore=max-line-length
|
||||
onready var brakes_sensitivity_slider: HSlider = $MarginContainer/VSplitContainer/TabContainer/Controls/Controls/BrakesSensitivitySlider
|
||||
|
||||
# gdlint: ignore=max-line-length
|
||||
onready var steering_value_slider: HSlider = $MarginContainer/VSplitContainer/TabContainer/Controls/Controls/HBoxContainer/Steering/HSlider
|
||||
# gdlint: ignore=max-line-length
|
||||
onready var throttle_value_slider: HSlider = $MarginContainer/VSplitContainer/TabContainer/Controls/Controls/HBoxContainer/Throttle/HSlider
|
||||
# gdlint: ignore=max-line-length
|
||||
onready var brakes_value_slider: HSlider = $MarginContainer/VSplitContainer/TabContainer/Controls/Controls/HBoxContainer/Brakes/HSlider
|
||||
# gdlint: ignore=max-line-length
|
||||
onready var gear_value_slider: HSlider = $MarginContainer/VSplitContainer/TabContainer/Controls/Controls/HBoxContainer/Gear/HSlider
|
||||
|
||||
# gdlint: ignore=max-line-length
|
||||
onready var fov_slider: HSlider = $MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera/FovSlider
|
||||
# gdlint: ignore=max-line-length
|
||||
onready var move_depth_slider: HSlider = $MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera/MoveDepthSlider
|
||||
# gdlint: ignore=max-line-length
|
||||
onready var move_horizontal_slider: HSlider = $MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera/MoveHorizontalSlider
|
||||
# gdlint: ignore=max-line-length
|
||||
onready var move_vertical_slider: HSlider = $MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera/MoveVerticalSlider
|
||||
# gdlint: ignore=max-line-length
|
||||
onready var vehicle_selector: OptionButton = $MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/VBoxContainer/VehicleSelector
|
||||
# gdlint: ignore=max-line-length
|
||||
onready var viewport: Viewport = $MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/VBoxContainer/ViewportContainer/Viewport
|
||||
onready var camera_scene = CAMERA_TEST_SCENE.instance()
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
@ -30,13 +76,44 @@ func _ready() -> void:
|
|||
auto_clutch_cb.pressed = GlobalSettings.auto_clutch
|
||||
automatic_transmission_cb.pressed = GlobalSettings.automatic_transmission
|
||||
multiplayer_name_box.text = GlobalSettings.multiplayer_name
|
||||
steering_sensitivity_slider.value = GlobalSettings.steering_sensitivity
|
||||
steering_return_speed_slider.value = GlobalSettings.return_speed
|
||||
steering_deadzone_inner_slider.value = GlobalSettings.steering_deadzone_inner
|
||||
steering_deadzone_outer_slider.value = GlobalSettings.steering_deadzone_outer
|
||||
throttle_sensitivity_slider.value = GlobalSettings.throttle_sensitivity
|
||||
brakes_sensitivity_slider.value = GlobalSettings.brake_sensitivity
|
||||
fov_slider.value = GlobalSettings.camera_fov
|
||||
move_depth_slider.value = GlobalSettings.camera_move_depth
|
||||
move_horizontal_slider.value = GlobalSettings.camera_move_horizontal
|
||||
move_vertical_slider.value = GlobalSettings.camera_move_vertical
|
||||
fullscreen_cb.pressed = false
|
||||
borderless_cb.pressed = false
|
||||
var controller = PLAYER_CONTROLLER.new()
|
||||
controller.input_sink_path = get_path()
|
||||
add_child(controller)
|
||||
if OS.is_window_fullscreen():
|
||||
_set_fullscreen(true)
|
||||
if OS.get_borderless_window():
|
||||
_set_borderless(true)
|
||||
|
||||
vehicle_selector.add_item("Beetlecar")
|
||||
vehicle_selector.add_item("Buggy")
|
||||
vehicle_selector.add_item("Bugmobile")
|
||||
vehicle_selector.selected = 1
|
||||
|
||||
viewport.add_child(camera_scene)
|
||||
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
steering_value_slider.value = -inputs.steering
|
||||
throttle_value_slider.value = inputs.throttle
|
||||
brakes_value_slider.value = inputs.brake
|
||||
match inputs.gear_request:
|
||||
BuggedVehicle.GearRequest.UP:
|
||||
gear_value_slider.value += 1
|
||||
BuggedVehicle.GearRequest.DOWN:
|
||||
gear_value_slider.value -= 1
|
||||
|
||||
|
||||
func _on_autoclutch_toggled(new_state: bool) -> void:
|
||||
GlobalSettings.auto_clutch = new_state
|
||||
|
@ -74,6 +151,57 @@ func _on_MusicSlider_value_changed(new_value: float) -> void:
|
|||
AudioServer.set_bus_volume_db(music_bus, linear2db(new_value))
|
||||
|
||||
|
||||
func _on_SteeringSensitivitySlider_value_changed(new_value: float) -> void:
|
||||
GlobalSettings.steering_sensitivity = new_value
|
||||
|
||||
|
||||
func _on_SteeringReturnSpeedSlider_value_changed(new_value: float) -> void:
|
||||
GlobalSettings.return_speed = new_value
|
||||
|
||||
|
||||
func _on_SteeringInnerDeadzoneSlider_value_changed(new_value: float) -> void:
|
||||
GlobalSettings.steering_deadzone_inner = new_value
|
||||
|
||||
|
||||
func _on_SteeringOuterDeadzoneSlider_value_changed(new_value: float) -> void:
|
||||
GlobalSettings.steering_deadzone_outer = new_value
|
||||
|
||||
|
||||
func _on_ThrottleSensitivitySlider_value_changed(new_value: float) -> void:
|
||||
GlobalSettings.throttle_sensitivity = new_value
|
||||
|
||||
|
||||
func _on_BrakesSensitivitySlider_value_changed(new_value: float) -> void:
|
||||
GlobalSettings.brake_sensitivity = new_value
|
||||
|
||||
|
||||
func _on_FovSlider_value_changed(new_value: float) -> void:
|
||||
GlobalSettings.camera_fov = new_value
|
||||
|
||||
|
||||
func _on_MoveDepthSlider_value_changed(new_value: float) -> void:
|
||||
GlobalSettings.camera_move_depth = new_value
|
||||
|
||||
|
||||
func _on_MoveHorizontalSlider_value_changed(new_value: float) -> void:
|
||||
GlobalSettings.camera_move_horizontal = new_value
|
||||
|
||||
|
||||
func _on_MoveVerticalSlider_value_changed(new_value: float) -> void:
|
||||
GlobalSettings.camera_move_vertical = new_value
|
||||
|
||||
|
||||
func _on_VehicleSelector_item_selected(item_index: int) -> void:
|
||||
camera_scene.change_vehicle_to(vehicles[item_index])
|
||||
|
||||
|
||||
func _on_ResetToDefaultButton_pressed() -> void:
|
||||
fov_slider.value = 70
|
||||
move_depth_slider.value = 0
|
||||
move_horizontal_slider.value = 0
|
||||
move_vertical_slider.value = 0
|
||||
|
||||
|
||||
func _set_fullscreen(new_state: bool) -> void:
|
||||
OS.set_window_fullscreen(new_state)
|
||||
OS.set_window_maximized(new_state)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=8 format=2]
|
||||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://assets/fonts/kenney-future-narrow.ttf" type="DynamicFontData" id=1]
|
||||
[ext_resource path="res://menu/settings_menu.gd" type="Script" id=2]
|
||||
|
@ -8,16 +8,12 @@
|
|||
size = 64
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=4]
|
||||
size = 24
|
||||
[sub_resource type="DynamicFont" id=5]
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=3]
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=5]
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
[node name="SettingsMenu" type="Panel"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
|
@ -34,10 +30,13 @@ margin_left = 20.0
|
|||
margin_top = 20.0
|
||||
margin_right = -20.0
|
||||
margin_bottom = -20.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="VSplitContainer" type="VSplitContainer" parent="MarginContainer"]
|
||||
margin_right = 984.0
|
||||
margin_bottom = 705.0
|
||||
margin_bottom = 560.0
|
||||
dragger_visibility = 1
|
||||
|
||||
[node name="HSplitContainer" type="HSplitContainer" parent="MarginContainer/VSplitContainer"]
|
||||
|
@ -59,52 +58,27 @@ text = "Settings"
|
|||
align = 1
|
||||
valign = 1
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="MarginContainer/VSplitContainer"]
|
||||
[node name="TabContainer" type="TabContainer" parent="MarginContainer/VSplitContainer"]
|
||||
margin_top = 96.0
|
||||
margin_right = 984.0
|
||||
margin_bottom = 705.0
|
||||
margin_bottom = 560.0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VSplitContainer/CenterContainer"]
|
||||
margin_left = 356.0
|
||||
margin_right = 627.0
|
||||
margin_bottom = 609.0
|
||||
[node name="Gameplay" type="ScrollContainer" parent="MarginContainer/VSplitContainer/TabContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 8.0
|
||||
margin_top = 72.0
|
||||
margin_right = -8.0
|
||||
margin_bottom = -8.0
|
||||
|
||||
[node name="Gameplay" type="Label" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
|
||||
margin_right = 271.0
|
||||
margin_bottom = 27.0
|
||||
custom_fonts/font = SubResource( 4 )
|
||||
text = "Gameplay"
|
||||
align = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
[node name="Gameplay" type="VBoxContainer" parent="MarginContainer/VSplitContainer/TabContainer/Gameplay"]
|
||||
margin_right = 968.0
|
||||
margin_bottom = 82.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="AutoClutchCheckBox" type="CheckBox" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
|
||||
margin_top = 35.0
|
||||
margin_right = 271.0
|
||||
margin_bottom = 83.0
|
||||
custom_fonts/font = SubResource( 3 )
|
||||
text = "Automatic Clutch"
|
||||
align = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="AutomaticTransmissionCheckBox" type="CheckBox" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
|
||||
margin_top = 91.0
|
||||
margin_right = 271.0
|
||||
margin_bottom = 139.0
|
||||
custom_fonts/font = SubResource( 3 )
|
||||
text = "Automatic Transmission"
|
||||
align = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="MultiplayerNameLabel" type="Label" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
|
||||
margin_top = 147.0
|
||||
margin_right = 271.0
|
||||
margin_bottom = 165.0
|
||||
[node name="MultiplayerNameLabel" type="Label" parent="MarginContainer/VSplitContainer/TabContainer/Gameplay/Gameplay"]
|
||||
margin_right = 968.0
|
||||
margin_bottom = 18.0
|
||||
custom_fonts/font = SubResource( 5 )
|
||||
text = "Multiplayer name"
|
||||
align = 1
|
||||
|
@ -112,26 +86,31 @@ __meta__ = {
|
|||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="MultiplayerNameBox" type="LineEdit" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
|
||||
margin_top = 173.0
|
||||
margin_right = 271.0
|
||||
margin_bottom = 229.0
|
||||
[node name="MultiplayerNameBox" type="LineEdit" parent="MarginContainer/VSplitContainer/TabContainer/Gameplay/Gameplay"]
|
||||
margin_top = 26.0
|
||||
margin_right = 968.0
|
||||
margin_bottom = 82.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="AudioLabel" type="Label" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
|
||||
margin_top = 237.0
|
||||
margin_right = 271.0
|
||||
margin_bottom = 264.0
|
||||
custom_fonts/font = SubResource( 4 )
|
||||
text = "Audio"
|
||||
align = 1
|
||||
[node name="Audio" type="ScrollContainer" parent="MarginContainer/VSplitContainer/TabContainer"]
|
||||
visible = false
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 8.0
|
||||
margin_top = 72.0
|
||||
margin_right = -8.0
|
||||
margin_bottom = -8.0
|
||||
|
||||
[node name="MasterLabel" type="Label" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
|
||||
margin_top = 272.0
|
||||
margin_right = 271.0
|
||||
margin_bottom = 290.0
|
||||
[node name="Audio" type="VBoxContainer" parent="MarginContainer/VSplitContainer/TabContainer/Audio"]
|
||||
margin_right = 968.0
|
||||
margin_bottom = 190.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="MasterLabel" type="Label" parent="MarginContainer/VSplitContainer/TabContainer/Audio/Audio"]
|
||||
margin_right = 968.0
|
||||
margin_bottom = 18.0
|
||||
custom_fonts/font = SubResource( 5 )
|
||||
text = "Master"
|
||||
align = 1
|
||||
|
@ -139,10 +118,10 @@ __meta__ = {
|
|||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="MasterSlider" type="HSlider" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
|
||||
margin_top = 298.0
|
||||
margin_right = 271.0
|
||||
margin_bottom = 330.0
|
||||
[node name="MasterSlider" type="HSlider" parent="MarginContainer/VSplitContainer/TabContainer/Audio/Audio"]
|
||||
margin_top = 26.0
|
||||
margin_right = 968.0
|
||||
margin_bottom = 58.0
|
||||
max_value = 1.0
|
||||
step = 0.05
|
||||
value = 1.0
|
||||
|
@ -150,10 +129,10 @@ __meta__ = {
|
|||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="SoundEffectsLabel" type="Label" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
|
||||
margin_top = 338.0
|
||||
margin_right = 271.0
|
||||
margin_bottom = 356.0
|
||||
[node name="SoundEffectsLabel" type="Label" parent="MarginContainer/VSplitContainer/TabContainer/Audio/Audio"]
|
||||
margin_top = 66.0
|
||||
margin_right = 968.0
|
||||
margin_bottom = 84.0
|
||||
custom_fonts/font = SubResource( 5 )
|
||||
text = "Sound Effects"
|
||||
align = 1
|
||||
|
@ -161,10 +140,10 @@ __meta__ = {
|
|||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="SoundEffectsSlider" type="HSlider" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
|
||||
margin_top = 364.0
|
||||
margin_right = 271.0
|
||||
margin_bottom = 396.0
|
||||
[node name="SoundEffectsSlider" type="HSlider" parent="MarginContainer/VSplitContainer/TabContainer/Audio/Audio"]
|
||||
margin_top = 92.0
|
||||
margin_right = 968.0
|
||||
margin_bottom = 124.0
|
||||
max_value = 1.0
|
||||
step = 0.05
|
||||
value = 1.0
|
||||
|
@ -172,10 +151,10 @@ __meta__ = {
|
|||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="MusicLabel" type="Label" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
|
||||
margin_top = 404.0
|
||||
margin_right = 271.0
|
||||
margin_bottom = 422.0
|
||||
[node name="MusicLabel" type="Label" parent="MarginContainer/VSplitContainer/TabContainer/Audio/Audio"]
|
||||
margin_top = 132.0
|
||||
margin_right = 968.0
|
||||
margin_bottom = 150.0
|
||||
custom_fonts/font = SubResource( 5 )
|
||||
text = "Music"
|
||||
align = 1
|
||||
|
@ -183,10 +162,10 @@ __meta__ = {
|
|||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="MusicSlider" type="HSlider" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
|
||||
margin_top = 430.0
|
||||
margin_right = 271.0
|
||||
margin_bottom = 462.0
|
||||
[node name="MusicSlider" type="HSlider" parent="MarginContainer/VSplitContainer/TabContainer/Audio/Audio"]
|
||||
margin_top = 158.0
|
||||
margin_right = 968.0
|
||||
margin_bottom = 190.0
|
||||
max_value = 1.0
|
||||
step = 0.05
|
||||
value = 1.0
|
||||
|
@ -194,18 +173,34 @@ __meta__ = {
|
|||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="VideoLabel" type="Label" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
|
||||
margin_top = 470.0
|
||||
margin_right = 271.0
|
||||
margin_bottom = 497.0
|
||||
custom_fonts/font = SubResource( 4 )
|
||||
text = "Video"
|
||||
align = 1
|
||||
[node name="Video" type="ScrollContainer" parent="MarginContainer/VSplitContainer/TabContainer"]
|
||||
visible = false
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 8.0
|
||||
margin_top = 72.0
|
||||
margin_right = -8.0
|
||||
margin_bottom = -8.0
|
||||
|
||||
[node name="FullscreenCheckBox" type="CheckBox" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
|
||||
margin_top = 505.0
|
||||
margin_right = 271.0
|
||||
margin_bottom = 553.0
|
||||
[node name="TabContainer" type="TabContainer" parent="MarginContainer/VSplitContainer/TabContainer/Video"]
|
||||
margin_right = 968.0
|
||||
margin_bottom = 384.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="System" type="VBoxContainer" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 8.0
|
||||
margin_top = 72.0
|
||||
margin_right = -8.0
|
||||
margin_bottom = -8.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="FullscreenCheckBox" type="CheckBox" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/System"]
|
||||
margin_right = 952.0
|
||||
margin_bottom = 48.0
|
||||
custom_fonts/font = SubResource( 3 )
|
||||
text = "Fullscreen"
|
||||
align = 1
|
||||
|
@ -213,10 +208,10 @@ __meta__ = {
|
|||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="BorderlessCheckBox" type="CheckBox" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
|
||||
margin_top = 561.0
|
||||
margin_right = 271.0
|
||||
margin_bottom = 609.0
|
||||
[node name="BorderlessCheckBox" type="CheckBox" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/System"]
|
||||
margin_top = 56.0
|
||||
margin_right = 952.0
|
||||
margin_bottom = 104.0
|
||||
custom_fonts/font = SubResource( 3 )
|
||||
text = "Borderless"
|
||||
align = 1
|
||||
|
@ -224,11 +219,410 @@ __meta__ = {
|
|||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Camera" type="HSplitContainer" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer"]
|
||||
visible = false
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 8.0
|
||||
margin_top = 72.0
|
||||
margin_right = -8.0
|
||||
margin_bottom = -8.0
|
||||
size_flags_horizontal = 3
|
||||
split_offset = -500
|
||||
|
||||
[node name="Camera" type="VBoxContainer" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera"]
|
||||
margin_right = 226.0
|
||||
margin_bottom = 556.0
|
||||
rect_pivot_offset = Vector2( -793.71, -168 )
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="FovLabel" type="Label" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera"]
|
||||
margin_right = 404.0
|
||||
margin_bottom = 18.0
|
||||
custom_fonts/font = SubResource( 5 )
|
||||
text = "FOV"
|
||||
align = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="FovSlider" type="HSlider" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera"]
|
||||
margin_top = 26.0
|
||||
margin_right = 404.0
|
||||
margin_bottom = 58.0
|
||||
min_value = 1.0
|
||||
max_value = 180.0
|
||||
step = 0.01
|
||||
value = 70.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="MoveDepthLabel" type="Label" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera"]
|
||||
margin_top = 66.0
|
||||
margin_right = 404.0
|
||||
margin_bottom = 84.0
|
||||
custom_fonts/font = SubResource( 5 )
|
||||
text = "Move forward/backward"
|
||||
align = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="MoveDepthSlider" type="HSlider" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera"]
|
||||
margin_top = 92.0
|
||||
margin_right = 404.0
|
||||
margin_bottom = 124.0
|
||||
min_value = -1.0
|
||||
max_value = 1.0
|
||||
step = 0.001
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="MoveHorizontalLabel" type="Label" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera"]
|
||||
margin_top = 198.0
|
||||
margin_right = 404.0
|
||||
margin_bottom = 216.0
|
||||
custom_fonts/font = SubResource( 5 )
|
||||
text = "Move left/right"
|
||||
align = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="MoveHorizontalSlider" type="HSlider" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera"]
|
||||
margin_top = 224.0
|
||||
margin_right = 404.0
|
||||
margin_bottom = 256.0
|
||||
min_value = -1.0
|
||||
max_value = 1.0
|
||||
step = 0.001
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="MoveVerticalLabel" type="Label" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera"]
|
||||
margin_top = 330.0
|
||||
margin_right = 404.0
|
||||
margin_bottom = 348.0
|
||||
custom_fonts/font = SubResource( 5 )
|
||||
text = "Move down/up"
|
||||
align = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="MoveVerticalSlider" type="HSlider" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera"]
|
||||
margin_top = 356.0
|
||||
margin_right = 404.0
|
||||
margin_bottom = 388.0
|
||||
min_value = -1.0
|
||||
max_value = 1.0
|
||||
step = 0.001
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ResetToDefaultButton" type="Button" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera"]
|
||||
margin_right = 24.0
|
||||
margin_bottom = 48.0
|
||||
text = "Reset to default"
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera"]
|
||||
margin_left = 250.0
|
||||
margin_right = 952.0
|
||||
margin_bottom = 556.0
|
||||
|
||||
[node name="ViewportContainer" type="ViewportContainer" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/VBoxContainer"]
|
||||
margin_left = 153.0
|
||||
margin_right = 952.0
|
||||
margin_bottom = 500.0
|
||||
|
||||
[node name="Viewport" type="Viewport" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/VBoxContainer/ViewportContainer"]
|
||||
size = Vector2( 500, 500 )
|
||||
handle_input_locally = false
|
||||
render_target_update_mode = 0
|
||||
gui_disable_input = true
|
||||
|
||||
[node name="VehicleSelector" type="OptionButton" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/VBoxContainer"]
|
||||
margin_right = 349.0
|
||||
margin_bottom = 48.0
|
||||
align = 1
|
||||
|
||||
[node name="Controls" type="ScrollContainer" parent="MarginContainer/VSplitContainer/TabContainer"]
|
||||
visible = false
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 8.0
|
||||
margin_top = 72.0
|
||||
margin_right = -8.0
|
||||
margin_bottom = -8.0
|
||||
|
||||
[node name="Controls" type="VBoxContainer" parent="MarginContainer/VSplitContainer/TabContainer/Controls"]
|
||||
margin_right = 968.0
|
||||
margin_bottom = 566.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VSplitContainer/TabContainer/Controls/Controls"]
|
||||
margin_right = 944.0
|
||||
margin_bottom = 58.0
|
||||
|
||||
[node name="Steering" type="VBoxContainer" parent="MarginContainer/VSplitContainer/TabContainer/Controls/Controls/HBoxContainer"]
|
||||
margin_right = 230.0
|
||||
margin_bottom = 58.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VSplitContainer/TabContainer/Controls/Controls/HBoxContainer/Steering"]
|
||||
margin_right = 230.0
|
||||
margin_bottom = 18.0
|
||||
custom_fonts/font = SubResource( 3 )
|
||||
text = "Steering"
|
||||
|
||||
[node name="HSlider" type="HSlider" parent="MarginContainer/VSplitContainer/TabContainer/Controls/Controls/HBoxContainer/Steering"]
|
||||
margin_top = 26.0
|
||||
margin_right = 230.0
|
||||
margin_bottom = 58.0
|
||||
min_value = -1.0
|
||||
max_value = 1.0
|
||||
step = 0.01
|
||||
editable = false
|
||||
|
||||
[node name="Throttle" type="VBoxContainer" parent="MarginContainer/VSplitContainer/TabContainer/Controls/Controls/HBoxContainer"]
|
||||
margin_left = 238.0
|
||||
margin_right = 468.0
|
||||
margin_bottom = 58.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VSplitContainer/TabContainer/Controls/Controls/HBoxContainer/Throttle"]
|
||||
margin_right = 230.0
|
||||
margin_bottom = 18.0
|
||||
custom_fonts/font = SubResource( 3 )
|
||||
text = "Throttle"
|
||||
|
||||
[node name="HSlider" type="HSlider" parent="MarginContainer/VSplitContainer/TabContainer/Controls/Controls/HBoxContainer/Throttle"]
|
||||
margin_top = 26.0
|
||||
margin_right = 230.0
|
||||
margin_bottom = 58.0
|
||||
max_value = 1.0
|
||||
step = 0.01
|
||||
editable = false
|
||||
|
||||
[node name="Brakes" type="VBoxContainer" parent="MarginContainer/VSplitContainer/TabContainer/Controls/Controls/HBoxContainer"]
|
||||
margin_left = 476.0
|
||||
margin_right = 706.0
|
||||
margin_bottom = 58.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VSplitContainer/TabContainer/Controls/Controls/HBoxContainer/Brakes"]
|
||||
margin_right = 230.0
|
||||
margin_bottom = 18.0
|
||||
custom_fonts/font = SubResource( 3 )
|
||||
text = "Brakes"
|
||||
|
||||
[node name="HSlider" type="HSlider" parent="MarginContainer/VSplitContainer/TabContainer/Controls/Controls/HBoxContainer/Brakes"]
|
||||
margin_top = 26.0
|
||||
margin_right = 230.0
|
||||
margin_bottom = 58.0
|
||||
max_value = 1.0
|
||||
step = 0.01
|
||||
editable = false
|
||||
|
||||
[node name="Gear" type="VBoxContainer" parent="MarginContainer/VSplitContainer/TabContainer/Controls/Controls/HBoxContainer"]
|
||||
margin_left = 714.0
|
||||
margin_right = 944.0
|
||||
margin_bottom = 58.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VSplitContainer/TabContainer/Controls/Controls/HBoxContainer/Gear"]
|
||||
margin_right = 230.0
|
||||
margin_bottom = 18.0
|
||||
custom_fonts/font = SubResource( 3 )
|
||||
text = "Gear"
|
||||
|
||||
[node name="HSlider" type="HSlider" parent="MarginContainer/VSplitContainer/TabContainer/Controls/Controls/HBoxContainer/Gear"]
|
||||
margin_top = 26.0
|
||||
margin_right = 230.0
|
||||
margin_bottom = 58.0
|
||||
min_value = -1.0
|
||||
max_value = 6.0
|
||||
editable = false
|
||||
|
||||
[node name="AutoClutchCheckBox" type="CheckBox" parent="MarginContainer/VSplitContainer/TabContainer/Controls/Controls"]
|
||||
margin_top = 66.0
|
||||
margin_right = 944.0
|
||||
margin_bottom = 114.0
|
||||
custom_fonts/font = SubResource( 3 )
|
||||
text = "Automatic Clutch"
|
||||
align = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="AutomaticTransmissionCheckBox" type="CheckBox" parent="MarginContainer/VSplitContainer/TabContainer/Controls/Controls"]
|
||||
margin_top = 122.0
|
||||
margin_right = 944.0
|
||||
margin_bottom = 170.0
|
||||
custom_fonts/font = SubResource( 3 )
|
||||
text = "Automatic Transmission"
|
||||
align = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="SteeringSensitivityLabel" type="Label" parent="MarginContainer/VSplitContainer/TabContainer/Controls/Controls"]
|
||||
margin_top = 178.0
|
||||
margin_right = 944.0
|
||||
margin_bottom = 196.0
|
||||
custom_fonts/font = SubResource( 5 )
|
||||
text = "Steering Sensitivity"
|
||||
align = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="SteeringSensitivitySlider" type="HSlider" parent="MarginContainer/VSplitContainer/TabContainer/Controls/Controls"]
|
||||
margin_top = 204.0
|
||||
margin_right = 944.0
|
||||
margin_bottom = 236.0
|
||||
min_value = 0.01
|
||||
max_value = 1.0
|
||||
step = 0.01
|
||||
value = 1.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="SteeringInnerDeadzoneLabel" type="Label" parent="MarginContainer/VSplitContainer/TabContainer/Controls/Controls"]
|
||||
margin_top = 244.0
|
||||
margin_right = 944.0
|
||||
margin_bottom = 262.0
|
||||
custom_fonts/font = SubResource( 5 )
|
||||
text = "Steering Inner Deadzone"
|
||||
align = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="SteeringInnerDeadzoneSlider" type="HSlider" parent="MarginContainer/VSplitContainer/TabContainer/Controls/Controls"]
|
||||
margin_top = 270.0
|
||||
margin_right = 944.0
|
||||
margin_bottom = 302.0
|
||||
max_value = 0.4
|
||||
step = 0.01
|
||||
value = 0.4
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="SteeringOuterDeadzoneLabel" type="Label" parent="MarginContainer/VSplitContainer/TabContainer/Controls/Controls"]
|
||||
margin_top = 310.0
|
||||
margin_right = 944.0
|
||||
margin_bottom = 328.0
|
||||
custom_fonts/font = SubResource( 5 )
|
||||
text = "Steering Outer Deadzone"
|
||||
align = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="SteeringOuterDeadzoneSlider" type="HSlider" parent="MarginContainer/VSplitContainer/TabContainer/Controls/Controls"]
|
||||
margin_top = 336.0
|
||||
margin_right = 944.0
|
||||
margin_bottom = 368.0
|
||||
max_value = 0.4
|
||||
step = 0.01
|
||||
value = 0.4
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="SteeringReturnSpeedLabel" type="Label" parent="MarginContainer/VSplitContainer/TabContainer/Controls/Controls"]
|
||||
margin_top = 376.0
|
||||
margin_right = 944.0
|
||||
margin_bottom = 394.0
|
||||
custom_fonts/font = SubResource( 5 )
|
||||
text = "Steering Return Speed"
|
||||
align = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="SteeringReturnSpeedSlider" type="HSlider" parent="MarginContainer/VSplitContainer/TabContainer/Controls/Controls"]
|
||||
margin_top = 402.0
|
||||
margin_right = 944.0
|
||||
margin_bottom = 434.0
|
||||
max_value = 60.0
|
||||
step = 0.01
|
||||
value = 1.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ThrottleSensitivityLabel" type="Label" parent="MarginContainer/VSplitContainer/TabContainer/Controls/Controls"]
|
||||
margin_top = 442.0
|
||||
margin_right = 944.0
|
||||
margin_bottom = 460.0
|
||||
custom_fonts/font = SubResource( 5 )
|
||||
text = "Throttle Sensitivity"
|
||||
align = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ThrottleSensitivitySlider" type="HSlider" parent="MarginContainer/VSplitContainer/TabContainer/Controls/Controls"]
|
||||
margin_top = 468.0
|
||||
margin_right = 944.0
|
||||
margin_bottom = 500.0
|
||||
min_value = 0.01
|
||||
max_value = 1.0
|
||||
step = 0.01
|
||||
value = 1.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="BrakesSensitivityLabel" type="Label" parent="MarginContainer/VSplitContainer/TabContainer/Controls/Controls"]
|
||||
margin_top = 508.0
|
||||
margin_right = 944.0
|
||||
margin_bottom = 526.0
|
||||
custom_fonts/font = SubResource( 5 )
|
||||
text = "Brakes Sensitivity"
|
||||
align = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="BrakesSensitivitySlider" type="HSlider" parent="MarginContainer/VSplitContainer/TabContainer/Controls/Controls"]
|
||||
margin_top = 534.0
|
||||
margin_right = 944.0
|
||||
margin_bottom = 566.0
|
||||
min_value = 0.01
|
||||
max_value = 1.0
|
||||
step = 0.01
|
||||
value = 1.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[connection signal="pressed" from="MarginContainer/VSplitContainer/HSplitContainer/BackButton" to="." method="_on_BackButton_pressed"]
|
||||
[connection signal="toggled" from="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/AutoClutchCheckBox" to="." method="_on_autoclutch_toggled"]
|
||||
[connection signal="toggled" from="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/AutomaticTransmissionCheckBox" to="." method="_on_automatictransmission_toggled"]
|
||||
[connection signal="value_changed" from="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/MasterSlider" to="." method="_on_MasterSlider_value_changed"]
|
||||
[connection signal="value_changed" from="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/SoundEffectsSlider" to="." method="_on_SoundEffectsSlider_value_changed"]
|
||||
[connection signal="value_changed" from="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/MusicSlider" to="." method="_on_MusicSlider_value_changed"]
|
||||
[connection signal="toggled" from="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/FullscreenCheckBox" to="." method="_on_fullscreen_toggled"]
|
||||
[connection signal="toggled" from="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/BorderlessCheckBox" to="." method="_on_borderless_toggled"]
|
||||
[connection signal="value_changed" from="MarginContainer/VSplitContainer/TabContainer/Audio/Audio/MasterSlider" to="." method="_on_MasterSlider_value_changed"]
|
||||
[connection signal="value_changed" from="MarginContainer/VSplitContainer/TabContainer/Audio/Audio/SoundEffectsSlider" to="." method="_on_SoundEffectsSlider_value_changed"]
|
||||
[connection signal="value_changed" from="MarginContainer/VSplitContainer/TabContainer/Audio/Audio/MusicSlider" to="." method="_on_MusicSlider_value_changed"]
|
||||
[connection signal="toggled" from="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/System/FullscreenCheckBox" to="." method="_on_fullscreen_toggled"]
|
||||
[connection signal="toggled" from="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/System/BorderlessCheckBox" to="." method="_on_borderless_toggled"]
|
||||
[connection signal="value_changed" from="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera/FovSlider" to="." method="_on_FovSlider_value_changed"]
|
||||
[connection signal="value_changed" from="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera/MoveDepthSlider" to="." method="_on_MoveDepthSlider_value_changed"]
|
||||
[connection signal="value_changed" from="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera/MoveHorizontalSlider" to="." method="_on_MoveHorizontalSlider_value_changed"]
|
||||
[connection signal="value_changed" from="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera/MoveVerticalSlider" to="." method="_on_MoveVerticalSlider_value_changed"]
|
||||
[connection signal="pressed" from="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera/ResetToDefaultButton" to="." method="_on_ResetToDefaultButton_pressed"]
|
||||
[connection signal="item_selected" from="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/VBoxContainer/VehicleSelector" to="." method="_on_VehicleSelector_item_selected"]
|
||||
[connection signal="toggled" from="MarginContainer/VSplitContainer/TabContainer/Controls/Controls/AutoClutchCheckBox" to="." method="_on_autoclutch_toggled"]
|
||||
[connection signal="toggled" from="MarginContainer/VSplitContainer/TabContainer/Controls/Controls/AutomaticTransmissionCheckBox" to="." method="_on_automatictransmission_toggled"]
|
||||
[connection signal="value_changed" from="MarginContainer/VSplitContainer/TabContainer/Controls/Controls/SteeringSensitivitySlider" to="." method="_on_SteeringSensitivitySlider_value_changed"]
|
||||
[connection signal="value_changed" from="MarginContainer/VSplitContainer/TabContainer/Controls/Controls/SteeringInnerDeadzoneSlider" to="." method="_on_SteeringInnerDeadzoneSlider_value_changed"]
|
||||
[connection signal="value_changed" from="MarginContainer/VSplitContainer/TabContainer/Controls/Controls/SteeringOuterDeadzoneSlider" to="." method="_on_SteeringOuterDeadzoneSlider_value_changed"]
|
||||
[connection signal="value_changed" from="MarginContainer/VSplitContainer/TabContainer/Controls/Controls/SteeringReturnSpeedSlider" to="." method="_on_SteeringReturnSpeedSlider_value_changed"]
|
||||
[connection signal="value_changed" from="MarginContainer/VSplitContainer/TabContainer/Controls/Controls/ThrottleSensitivitySlider" to="." method="_on_ThrottleSensitivitySlider_value_changed"]
|
||||
[connection signal="value_changed" from="MarginContainer/VSplitContainer/TabContainer/Controls/Controls/BrakesSensitivitySlider" to="." method="_on_BrakesSensitivitySlider_value_changed"]
|
||||
|
|
|
@ -10,7 +10,7 @@ var _cameras = []
|
|||
func attach_cameras_to(player_node: BuggedVehicle) -> void:
|
||||
var cockpit_camera = STATIC_CAMERA.instance()
|
||||
player_node.get_cockpit_position().add_child(cockpit_camera)
|
||||
cockpit_camera.rotate(Vector3.UP, deg2rad(180))
|
||||
cockpit_camera.reset()
|
||||
var follow_camera = FOLLOW_CAMERA.instance()
|
||||
follow_camera.global_transform = player_node.global_transform.translated(
|
||||
-player_node.global_transform.basis.z * 100
|
||||
|
@ -19,18 +19,20 @@ func attach_cameras_to(player_node: BuggedVehicle) -> void:
|
|||
player_node.get_parent().add_child(follow_camera)
|
||||
var bumpera_camera = STATIC_CAMERA.instance()
|
||||
player_node.get_bumper_position().add_child(bumpera_camera)
|
||||
bumpera_camera.rotate(Vector3.UP, deg2rad(180))
|
||||
var hood_camera = STATIC_CAMERA.instance()
|
||||
player_node.get_hood_position().add_child(hood_camera)
|
||||
hood_camera.rotate(Vector3.UP, deg2rad(180))
|
||||
var static_follow_camera = STATIC_CAMERA.instance()
|
||||
player_node.get_static_follow_position().add_child(static_follow_camera)
|
||||
static_follow_camera.rotate(Vector3.UP, deg2rad(180))
|
||||
_cameras = [follow_camera, cockpit_camera, hood_camera, bumpera_camera, static_follow_camera]
|
||||
for cam in _cameras:
|
||||
cam.reset()
|
||||
select_camera(GlobalSettings.selected_camera)
|
||||
|
||||
|
||||
func select_camera(camera_index: int) -> void:
|
||||
if _cameras.size() == 0:
|
||||
return
|
||||
|
||||
var select_index = camera_index
|
||||
if camera_index < 0 or camera_index >= _cameras.size():
|
||||
select_index = 0
|
||||
|
@ -39,5 +41,23 @@ func select_camera(camera_index: int) -> void:
|
|||
_cameras[select_index].current = true
|
||||
|
||||
|
||||
func clear():
|
||||
for cam in _cameras:
|
||||
cam.queue_free()
|
||||
_cameras = []
|
||||
|
||||
|
||||
func next_camera() -> void:
|
||||
select_camera(GlobalSettings.selected_camera + 1)
|
||||
|
||||
|
||||
func update_camera(horizontal: float, vertical: float, look_back: bool) -> void:
|
||||
horizontal = clamp(horizontal, -1.0, 1.0)
|
||||
vertical = clamp(vertical, -1.0, 1.0)
|
||||
|
||||
if look_back:
|
||||
horizontal = 2.0
|
||||
|
||||
for cam in _cameras:
|
||||
cam.reset()
|
||||
cam.update_rotation(horizontal, vertical)
|
||||
|
|
|
@ -6,6 +6,8 @@ export var target_height: float = 2.0
|
|||
|
||||
var follow_target: Node = null
|
||||
var last_lookat: Vector3
|
||||
var target_angle_horizontal = 0
|
||||
var target_angle_vertical = 0
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
|
@ -27,10 +29,28 @@ func _physics_process(delta):
|
|||
else:
|
||||
target_pos.y = follow_target.global_transform.origin.y + target_height
|
||||
|
||||
global_transform.origin = global_transform.origin.linear_interpolate(target_pos, delta * 20.0)
|
||||
|
||||
last_lookat = last_lookat.linear_interpolate(
|
||||
follow_target.global_transform.origin, delta * 20.0
|
||||
)
|
||||
|
||||
var original_diff = target_pos - follow_target.global_transform.origin
|
||||
var rotation_adjustment = (
|
||||
original_diff.rotated(Vector3.DOWN, target_angle_horizontal).rotated(
|
||||
Vector3.LEFT, target_angle_vertical
|
||||
)
|
||||
- original_diff
|
||||
)
|
||||
target_pos += rotation_adjustment
|
||||
|
||||
global_transform.origin = global_transform.origin.linear_interpolate(target_pos, delta * 20.0)
|
||||
|
||||
look_at(last_lookat, Vector3(0.0, 1.0, 0.0))
|
||||
|
||||
|
||||
func reset() -> void:
|
||||
pass
|
||||
|
||||
|
||||
func update_rotation(horizontal: float, vertical: float) -> void:
|
||||
target_angle_horizontal = horizontal * deg2rad(90)
|
||||
target_angle_vertical = vertical * deg2rad(90)
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
extends Camera
|
||||
|
||||
|
||||
func reset() -> void:
|
||||
rotation = Vector3.ZERO
|
||||
rotate(Vector3.UP, deg2rad(180))
|
||||
fov = GlobalSettings.camera_fov
|
||||
translation = Vector3.ZERO
|
||||
translate(
|
||||
Vector3(
|
||||
GlobalSettings.camera_move_horizontal,
|
||||
GlobalSettings.camera_move_vertical,
|
||||
GlobalSettings.camera_move_depth
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
func update_rotation(horizontal: float, vertical: float) -> void:
|
||||
rotate(Vector3.DOWN, horizontal * deg2rad(90))
|
||||
rotate(Vector3.LEFT, vertical * deg2rad(90))
|
|
@ -1,4 +1,7 @@
|
|||
[gd_scene format=2]
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://player/cameras/static_camera.gd" type="Script" id=1]
|
||||
|
||||
[node name="camera" type="Camera"]
|
||||
far = 1000.0
|
||||
script = ExtResource( 1 )
|
||||
|
|
|
@ -1,27 +1,63 @@
|
|||
class_name PlayerVehicleController
|
||||
extends Node
|
||||
|
||||
export(NodePath) var vehicle_path = null
|
||||
export(NodePath) var input_sink_path = null
|
||||
|
||||
onready var _vehicle: BuggedVehicle = get_node(vehicle_path)
|
||||
onready var _input_sink = get_node(input_sink_path)
|
||||
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
_vehicle.inputs.throttle = Input.get_action_strength("throttle")
|
||||
_vehicle.inputs.clutch = Input.get_action_strength("clutch")
|
||||
_vehicle.inputs.brake = Input.get_action_strength("brake")
|
||||
_vehicle.inputs.handbrake = Input.get_action_strength("handbrake")
|
||||
func _physics_process(delta: float) -> void:
|
||||
var steering_sensitivity = GlobalSettings.steering_sensitivity
|
||||
var return_speed = GlobalSettings.return_speed
|
||||
var throttle_sensitivity = GlobalSettings.throttle_sensitivity
|
||||
var brake_sensitivity = GlobalSettings.brake_sensitivity
|
||||
var steering_deadzone_inner = GlobalSettings.steering_deadzone_inner
|
||||
var steering_deadzone_outer = GlobalSettings.steering_deadzone_outer
|
||||
|
||||
_input_sink.inputs.throttle = move_toward(
|
||||
_input_sink.inputs.throttle,
|
||||
Input.get_action_strength("throttle"),
|
||||
lerp(delta, 1, throttle_sensitivity)
|
||||
)
|
||||
_input_sink.inputs.clutch = Input.get_action_strength("clutch")
|
||||
_input_sink.inputs.brake = move_toward(
|
||||
_input_sink.inputs.brake,
|
||||
Input.get_action_strength("brake"),
|
||||
lerp(delta, 1, brake_sensitivity)
|
||||
)
|
||||
_input_sink.inputs.handbrake = Input.get_action_strength("handbrake")
|
||||
var steering_input = (
|
||||
Input.get_action_strength("steer_left")
|
||||
- Input.get_action_strength("steer_right")
|
||||
)
|
||||
# TODO: deadzone config
|
||||
if abs(steering_input) < 0.05:
|
||||
|
||||
if abs(steering_input) <= steering_deadzone_inner:
|
||||
steering_input = 0.0
|
||||
_vehicle.inputs.steering = steering_input
|
||||
|
||||
if abs(steering_input) >= (1 - steering_deadzone_outer):
|
||||
steering_input = 1.0 * sign(steering_input)
|
||||
|
||||
if (
|
||||
abs(steering_input) > steering_deadzone_inner
|
||||
and abs(steering_input) < (1 - steering_deadzone_outer)
|
||||
):
|
||||
steering_input = (
|
||||
sign(steering_input)
|
||||
* inverse_lerp(
|
||||
steering_deadzone_inner, 1 - steering_deadzone_outer, abs(steering_input)
|
||||
)
|
||||
)
|
||||
|
||||
var steering_factor = steering_sensitivity
|
||||
if abs(_input_sink.inputs.steering) > abs(steering_input):
|
||||
steering_factor *= return_speed
|
||||
|
||||
_input_sink.inputs.steering = move_toward(
|
||||
_input_sink.inputs.steering, steering_input, lerp(delta, 1, steering_factor)
|
||||
)
|
||||
if Input.is_action_just_pressed("gear_up"):
|
||||
_vehicle.inputs.gear_request = BuggedVehicle.GearRequest.UP
|
||||
_input_sink.inputs.gear_request = BuggedVehicle.GearRequest.UP
|
||||
elif Input.is_action_just_pressed("gear_down"):
|
||||
_vehicle.inputs.gear_request = BuggedVehicle.GearRequest.DOWN
|
||||
_input_sink.inputs.gear_request = BuggedVehicle.GearRequest.DOWN
|
||||
else:
|
||||
_vehicle.inputs.gear_request = BuggedVehicle.GearRequest.NONE
|
||||
_input_sink.inputs.gear_request = BuggedVehicle.GearRequest.NONE
|
||||
|
|
|
@ -144,6 +144,36 @@ next_camera={
|
|||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":2,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
turn_camera_right={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":76,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":2,"axis_value":1.0,"script":null)
|
||||
]
|
||||
}
|
||||
turn_camera_left={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":74,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":2,"axis_value":-1.0,"script":null)
|
||||
]
|
||||
}
|
||||
turn_camera_up={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":73,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":3,"axis_value":-1.0,"script":null)
|
||||
]
|
||||
}
|
||||
turn_camera_down={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":75,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":3,"axis_value":1.0,"script":null)
|
||||
]
|
||||
}
|
||||
look_backwards={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":66,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":10,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[physics]
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ func _spawn_in_player():
|
|||
add_child(player_node)
|
||||
add_child(gui)
|
||||
player_controller = PLAYER_CONTROLLER.new()
|
||||
player_controller.vehicle_path = player_node.get_path()
|
||||
player_controller.input_sink_path = player_node.get_path()
|
||||
player_node.add_child(player_controller)
|
||||
camera_controller = CAMERA_CONTROLLER.new()
|
||||
camera_controller.attach_cameras_to(player_node)
|
||||
|
@ -65,6 +65,15 @@ func _process(_delta: float) -> void:
|
|||
if Input.is_action_just_released("next_camera"):
|
||||
camera_controller.next_camera()
|
||||
|
||||
camera_controller.update_camera(
|
||||
(
|
||||
Input.get_action_strength("turn_camera_right")
|
||||
- Input.get_action_strength("turn_camera_left")
|
||||
),
|
||||
Input.get_action_strength("turn_camera_up") - Input.get_action_strength("turn_camera_down"),
|
||||
Input.is_action_pressed("look_backwards")
|
||||
)
|
||||
|
||||
|
||||
func _on_ResetArea_body_entered(body: Node) -> void:
|
||||
if body.get_groups().has("car"):
|
||||
|
|
|
@ -1,15 +1,50 @@
|
|||
extends Node
|
||||
|
||||
var auto_clutch: bool = false
|
||||
var auto_clutch: bool = true
|
||||
var automatic_transmission: bool = true
|
||||
var steering_sensitivity = 1.0
|
||||
var return_speed = 2.0
|
||||
var throttle_sensitivity = 1.0
|
||||
var brake_sensitivity = 1.0
|
||||
var steering_deadzone_inner = 0.0
|
||||
var steering_deadzone_outer = 0.0
|
||||
|
||||
var selected_camera: int = 0
|
||||
var multiplayer_name: String = "Player"
|
||||
|
||||
var camera_fov = 70
|
||||
var camera_move_depth = 0
|
||||
var camera_move_horizontal = 0
|
||||
var camera_move_vertical = 0
|
||||
|
||||
var _config: Dictionary
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_config = read_json_file("res://info.json")
|
||||
get_tree().set_auto_accept_quit(false)
|
||||
var stored_config = read_json_file("user://settings.json")
|
||||
if stored_config.has("hidden"):
|
||||
selected_camera = stored_config["hidden"].get("selected_camera", 0)
|
||||
|
||||
if stored_config.has("gameplay"):
|
||||
multiplayer_name = stored_config["gameplay"].get("multiplayer_name", "Player")
|
||||
|
||||
if stored_config.has("controls"):
|
||||
auto_clutch = stored_config["controls"].get("auto_clutch", true)
|
||||
automatic_transmission = stored_config["controls"].get("automatic_transmission", true)
|
||||
steering_sensitivity = stored_config["controls"].get("steering_sensitivity", 1.0)
|
||||
return_speed = stored_config["controls"].get("return_speed", 2.0)
|
||||
throttle_sensitivity = stored_config["controls"].get("throttle_sensitivity", 1.0)
|
||||
brake_sensitivity = stored_config["controls"].get("brake_sensitivity", 1.0)
|
||||
steering_deadzone_inner = stored_config["controls"].get("steering_deadzone_inner", 1.0)
|
||||
steering_deadzone_outer = stored_config["controls"].get("steering_deadzone_outer", 1.0)
|
||||
|
||||
if stored_config.has("camera"):
|
||||
camera_fov = stored_config["camera"].get("fov", 70)
|
||||
camera_move_depth = stored_config["camera"].get("move_depth", 0)
|
||||
camera_move_horizontal = stored_config["camera"].get("move_horizontal", 0)
|
||||
camera_move_vertical = stored_config["camera"].get("move_vertical", 0)
|
||||
|
||||
|
||||
func read_json_file(file_path: String) -> Dictionary:
|
||||
|
@ -36,3 +71,39 @@ func get_version_string() -> String:
|
|||
var minor = version["minor"]
|
||||
var patch = version["patch"]
|
||||
return "%d.%d.%d" % [major, minor, patch]
|
||||
|
||||
|
||||
func save_settings() -> void:
|
||||
save_json_file("user://settings.json", to_dictionary())
|
||||
|
||||
|
||||
func to_dictionary() -> Dictionary:
|
||||
return {
|
||||
"hidden": {"selected_camera": selected_camera},
|
||||
"gameplay": {"multiplayer_name": multiplayer_name},
|
||||
"controls":
|
||||
{
|
||||
"auto_clutch": auto_clutch,
|
||||
"automatic_transmission": automatic_transmission,
|
||||
"steering_sensitivity": steering_sensitivity,
|
||||
"return_speed": return_speed,
|
||||
"throttle_sensitivity": throttle_sensitivity,
|
||||
"brake_sensitivity": brake_sensitivity,
|
||||
"steering_deadzone_inner": steering_deadzone_inner,
|
||||
"steering_deadzone_outer": steering_deadzone_outer,
|
||||
},
|
||||
"camera":
|
||||
{
|
||||
"fov": camera_fov,
|
||||
"move_depth": camera_move_depth,
|
||||
"move_horizontal": camera_move_horizontal,
|
||||
"move_vertical": camera_move_vertical
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Handle quit
|
||||
func _notification(what):
|
||||
if what == MainLoop.NOTIFICATION_WM_QUIT_REQUEST:
|
||||
save_settings()
|
||||
get_tree().quit() # default behavior
|
||||
|
|
|
@ -6,21 +6,16 @@
|
|||
[ext_resource path="res://vehicles/pedal.gd" type="Script" id=4]
|
||||
[ext_resource path="res://vehicles/meter.gd" type="Script" id=5]
|
||||
[ext_resource path="res://vehicles/steering_controller.gd" type="Script" id=6]
|
||||
[ext_resource path="res://assets/engine.wav" type="AudioStream" id=7]
|
||||
[ext_resource path="res://assets/wind woosh loop.ogg" type="AudioStream" id=8]
|
||||
|
||||
[sub_resource type="Curve" id=3]
|
||||
_data = [ Vector2( 0, 0 ), 0.0, 3.60634, 0, 1, Vector2( 0.15566, 0.561364 ), 1.56017, 1.56017, 0, 0, Vector2( 0.830189, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0 ), 0.0, 0.0, 0, 0 ]
|
||||
|
||||
[sub_resource type="Curve" id=4]
|
||||
_data = [ Vector2( 0, 0.492045 ), 0.0, 0.0, 0, 0, Vector2( 0.15566, 1 ), 0.0, 0.0, 0, 0, Vector2( 0.212264, 0 ), 0.0, 0.0, 0, 0, Vector2( 0.29717, 1 ), 0.0, 0.0, 0, 0, Vector2( 0.410377, 0 ), 0.0, 0.0, 0, 0, Vector2( 0.481132, 0.701136 ), 0.0, 0.0, 0, 0, Vector2( 0.566038, 0.282955 ), 0.0, 0.0, 0, 0, Vector2( 0.589623, 0.6375 ), 0.0, 0.0, 0, 0, Vector2( 0.660377, 0.373864 ), 0.0, 0.0, 0, 0, Vector2( 0.669811, 0.5375 ), 0.0, 0.0, 0, 0, Vector2( 0.764151, 0.0284091 ), 0.0, 0.0, 0, 0, Vector2( 0.811321, 1 ), 0.0, 0.0, 0, 0, Vector2( 0.938679, 0 ), 0.0, 0.0, 0, 0, Vector2( 1, 1 ), 0.0, 0.0, 0, 0 ]
|
||||
|
||||
[sub_resource type="CapsuleShape" id=11]
|
||||
radius = 0.394377
|
||||
height = 2.03536
|
||||
|
||||
[sub_resource type="AudioStreamGenerator" id=2]
|
||||
mix_rate = 5500.0
|
||||
buffer_length = 1.0
|
||||
|
||||
[sub_resource type="Curve" id=9]
|
||||
_data = [ Vector2( 0, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0.493182 ), 0.0, 0.0, 0, 0 ]
|
||||
|
||||
|
@ -46,30 +41,31 @@ radial_segments = 4
|
|||
rings = 3
|
||||
|
||||
[node name="beetlecar" groups=["car"] instance=ExtResource( 2 )]
|
||||
mass = 340.0
|
||||
mass = 750.0
|
||||
script = ExtResource( 1 )
|
||||
max_steer_angle = 18.0
|
||||
speed_steer_angle = 8.0
|
||||
max_steer_speed = 60.0
|
||||
max_steer_input = 60.0
|
||||
max_engine_force = 100.0
|
||||
max_brake_force = 60.0
|
||||
max_steer_input = 35.0
|
||||
max_engine_force = 650.0
|
||||
max_brake_force = 90.0
|
||||
base_engine_pitch = 0.38
|
||||
gear_ratios = [ 2.99, 2.5, 1.98, 1.56, 1.32, 1.12 ]
|
||||
final_drive = 4.0
|
||||
max_rpm = 8000.0
|
||||
gear_switch_time = 0.5
|
||||
expected_max_speed = 170.0
|
||||
drag_factor = 1.55
|
||||
downforce_factor = 0.2
|
||||
gear_ratios = [ 6.67, 4.95, 3.65, 2.78, 2.25 ]
|
||||
final_drive = 2.5
|
||||
max_rpm = 8500.0
|
||||
gear_switch_time = 0.3
|
||||
power_curve = SubResource( 3 )
|
||||
sound_curve = SubResource( 4 )
|
||||
automatic_gear_up_threshold = 0.85
|
||||
|
||||
[node name="rear_right" parent="." index="0"]
|
||||
use_as_traction = true
|
||||
wheel_roll_influence = 0.01
|
||||
wheel_radius = 0.38
|
||||
wheel_rest_length = 0.3
|
||||
wheel_friction_slip = 12.0
|
||||
wheel_friction_slip = 2.0
|
||||
suspension_travel = 0.3
|
||||
suspension_stiffness = 12.0
|
||||
suspension_max_force = 4000.0
|
||||
damping_compression = 0.75
|
||||
damping_relaxation = 0.8
|
||||
|
||||
|
@ -91,6 +87,7 @@ script = ExtResource( 5 )
|
|||
needle_path = NodePath("speed_needle")
|
||||
|
||||
[node name="steering_controller" parent="chassis/cockpit" index="5"]
|
||||
transform = Transform( -5.15093, 0, -4.50309e-07, 0, 5.15093, 0, 4.50309e-07, 0, -5.15093, 0.591791, 0.882535, 1.0757 )
|
||||
script = ExtResource( 6 )
|
||||
|
||||
[node name="rear_left" parent="." index="3"]
|
||||
|
@ -99,9 +96,10 @@ use_as_traction = true
|
|||
wheel_roll_influence = 0.01
|
||||
wheel_radius = 0.38
|
||||
wheel_rest_length = 0.3
|
||||
wheel_friction_slip = 12.0
|
||||
wheel_friction_slip = 2.0
|
||||
suspension_travel = 0.3
|
||||
suspension_stiffness = 12.0
|
||||
suspension_max_force = 4000.0
|
||||
damping_compression = 0.75
|
||||
damping_relaxation = 0.8
|
||||
|
||||
|
@ -113,9 +111,10 @@ use_as_steering = true
|
|||
wheel_roll_influence = 0.01
|
||||
wheel_radius = 0.38
|
||||
wheel_rest_length = 0.3
|
||||
wheel_friction_slip = 10.0
|
||||
wheel_friction_slip = 1.95
|
||||
suspension_travel = 0.3
|
||||
suspension_stiffness = 12.0
|
||||
suspension_max_force = 4000.0
|
||||
damping_compression = 0.75
|
||||
damping_relaxation = 0.8
|
||||
|
||||
|
@ -125,9 +124,10 @@ use_as_steering = true
|
|||
wheel_roll_influence = 0.01
|
||||
wheel_radius = 0.38
|
||||
wheel_rest_length = 0.3
|
||||
wheel_friction_slip = 10.0
|
||||
wheel_friction_slip = 1.95
|
||||
suspension_travel = 0.3
|
||||
suspension_stiffness = 12.0
|
||||
suspension_max_force = 4000.0
|
||||
damping_compression = 0.75
|
||||
damping_relaxation = 0.8
|
||||
|
||||
|
@ -140,8 +140,8 @@ shape = SubResource( 11 )
|
|||
|
||||
[node name="engine_sound_player" type="AudioStreamPlayer3D" parent="." index="7"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.14201, 0.968668 )
|
||||
stream = SubResource( 2 )
|
||||
unit_db = 14.0
|
||||
stream = ExtResource( 7 )
|
||||
pitch_scale = 0.1
|
||||
bus = "Sound"
|
||||
|
||||
[node name="Smoke" type="Particles" parent="." index="8"]
|
||||
|
@ -175,6 +175,10 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.535274, 1.89154 )
|
|||
[node name="static_follow" type="Position3D" parent="." index="16"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.59115, -3.01375 )
|
||||
|
||||
[node name="wind_sound_player" type="AudioStreamPlayer3D" parent="." index="17"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.08447, 1.12391 )
|
||||
stream = ExtResource( 8 )
|
||||
|
||||
[connection signal="brake_updated" from="." to="chassis/cockpit/brake_pedal" method="_on_value_updated"]
|
||||
[connection signal="clutch_updated" from="." to="chassis/cockpit/clutch_pedal" method="_on_value_updated"]
|
||||
[connection signal="rpm_updated" from="." to="chassis/cockpit/rpm_meter" method="_on_value_updated"]
|
||||
|
|
|
@ -5,21 +5,17 @@
|
|||
[ext_resource path="res://vehicles/vehicle.gd" type="Script" id=3]
|
||||
[ext_resource path="res://vehicles/steering_controller.gd" type="Script" id=4]
|
||||
[ext_resource path="res://vehicles/meter.gd" type="Script" id=5]
|
||||
[ext_resource path="res://assets/engine.wav" type="AudioStream" id=6]
|
||||
[ext_resource path="res://vehicles/pedal.gd" type="Script" id=7]
|
||||
[ext_resource path="res://assets/wind woosh loop.ogg" type="AudioStream" id=8]
|
||||
|
||||
[sub_resource type="Curve" id=2]
|
||||
_data = [ Vector2( 0, 0 ), 0.0, 0.0, 0, 0, Vector2( 0.0660377, 0.243255 ), 0.0, 0.0, 0, 0, Vector2( 0.25, 0.563636 ), 4.02975, 4.02975, 0, 0, Vector2( 0.518868, 0.761364 ), 3.22818, 3.22818, 0, 0, Vector2( 0.849057, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0 ), 0.0, 0.0, 0, 0 ]
|
||||
|
||||
[sub_resource type="Curve" id=4]
|
||||
_data = [ Vector2( 0, 0 ), 0.0, 0.0, 0, 0, Vector2( 0.0849057, 1 ), 0.0, 0.0, 0, 0, Vector2( 0.15566, 0.746591 ), 0.0, 0.0, 0, 0, Vector2( 0.349057, 1 ), 0.0, 0.0, 0, 0, Vector2( 0.382075, 0 ), 0.0, 0.0, 0, 0, Vector2( 0.400943, 1 ), 0.0, 0.0, 0, 0, Vector2( 0.438679, 0 ), 0.0, 0.0, 0, 0, Vector2( 1, 1 ), 0.0, 0.0, 0, 0 ]
|
||||
|
||||
[sub_resource type="CapsuleShape" id=11]
|
||||
radius = 0.452181
|
||||
height = 2.78888
|
||||
|
||||
[sub_resource type="AudioStreamGenerator" id=3]
|
||||
mix_rate = 5500.0
|
||||
|
||||
[sub_resource type="Curve" id=8]
|
||||
_data = [ Vector2( 0, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0.205682 ), 0.0, 0.0, 0, 0 ]
|
||||
|
||||
|
@ -45,19 +41,18 @@ radial_segments = 4
|
|||
rings = 3
|
||||
|
||||
[node name="buggy" groups=["car"] instance=ExtResource( 1 )]
|
||||
mass = 400.0
|
||||
mass = 1400.0
|
||||
script = ExtResource( 3 )
|
||||
max_steer_angle = 30.0
|
||||
speed_steer_angle = 14.0
|
||||
max_steer_speed = 120.0
|
||||
max_engine_force = 160.0
|
||||
max_brake_force = 80.0
|
||||
max_engine_force = 550.0
|
||||
max_brake_force = 220.0
|
||||
throttle_power = 10000.0
|
||||
max_rpm_loss_ps = 4000.0
|
||||
base_engine_pitch = 0.45
|
||||
drag_factor = 1.65
|
||||
downforce_factor = 1.1
|
||||
gear_ratios = [ 3.8, 2.7, 2.2, 1.75, 1.4, 1.2 ]
|
||||
max_rpm = 5000.0
|
||||
power_curve = SubResource( 2 )
|
||||
sound_curve = SubResource( 4 )
|
||||
automatic_gear_up_threshold = 0.85
|
||||
automatic_gear_down_threshold = 0.4
|
||||
|
||||
|
@ -93,7 +88,7 @@ use_as_traction = true
|
|||
use_as_steering = true
|
||||
wheel_radius = 0.6
|
||||
wheel_rest_length = 0.68
|
||||
wheel_friction_slip = 2.0
|
||||
wheel_friction_slip = 2.25
|
||||
suspension_travel = 1.2
|
||||
suspension_stiffness = 4.5
|
||||
suspension_max_force = 14000.0
|
||||
|
@ -110,7 +105,7 @@ use_as_traction = true
|
|||
use_as_steering = true
|
||||
wheel_radius = 0.6
|
||||
wheel_rest_length = 0.68
|
||||
wheel_friction_slip = 2.0
|
||||
wheel_friction_slip = 2.25
|
||||
suspension_travel = 1.2
|
||||
suspension_stiffness = 4.5
|
||||
suspension_max_force = 14000.0
|
||||
|
@ -124,7 +119,7 @@ transform = Transform( -1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
|
|||
use_as_traction = true
|
||||
wheel_radius = 0.6
|
||||
wheel_rest_length = 0.68
|
||||
wheel_friction_slip = 1.9
|
||||
wheel_friction_slip = 2.05
|
||||
suspension_travel = 1.2
|
||||
suspension_stiffness = 4.5
|
||||
suspension_max_force = 14000.0
|
||||
|
@ -136,7 +131,7 @@ transform = Transform( 1, 0, 0, 0, 1, -1.50996e-07, 0, 1.50996e-07, 1, -0.950755
|
|||
use_as_traction = true
|
||||
wheel_radius = 0.6
|
||||
wheel_rest_length = 0.68
|
||||
wheel_friction_slip = 1.9
|
||||
wheel_friction_slip = 2.05
|
||||
suspension_travel = 1.2
|
||||
suspension_stiffness = 4.5
|
||||
suspension_max_force = 14000.0
|
||||
|
@ -147,9 +142,9 @@ damping_relaxation = 0.94
|
|||
transform = Transform( -1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
|
||||
|
||||
[node name="engine_sound_player" type="AudioStreamPlayer3D" parent="." index="7"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.14201, 0.968668 )
|
||||
stream = SubResource( 3 )
|
||||
unit_db = 14.0
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.14201, -1.46122 )
|
||||
stream = ExtResource( 6 )
|
||||
pitch_scale = 0.1
|
||||
bus = "Sound"
|
||||
|
||||
[node name="Smoke" type="Particles" parent="." index="8"]
|
||||
|
@ -182,6 +177,10 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.811448, 1.79879 )
|
|||
[node name="static_follow" type="Position3D" parent="." index="16"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.15146, -4.84184 )
|
||||
|
||||
[node name="wind_sound_player" type="AudioStreamPlayer3D" parent="." index="17"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.39214, 1.12139 )
|
||||
stream = ExtResource( 8 )
|
||||
|
||||
[connection signal="brake_updated" from="." to="chassis/cockpit/brake_pedal" method="_on_value_updated"]
|
||||
[connection signal="clutch_updated" from="." to="chassis/cockpit/clutch_pedal" method="_on_value_updated"]
|
||||
[connection signal="rpm_updated" from="." to="chassis/cockpit/rpm_meter" method="_on_value_updated"]
|
||||
|
|
|
@ -6,20 +6,16 @@
|
|||
[ext_resource path="res://vehicles/steering_controller.gd" type="Script" id=4]
|
||||
[ext_resource path="res://vehicles/pedal.gd" type="Script" id=5]
|
||||
[ext_resource path="res://vehicles/meter.gd" type="Script" id=6]
|
||||
[ext_resource path="res://assets/engine.wav" type="AudioStream" id=7]
|
||||
[ext_resource path="res://assets/wind woosh loop.ogg" type="AudioStream" id=8]
|
||||
|
||||
[sub_resource type="Curve" id=18]
|
||||
_data = [ Vector2( 0, 0 ), 0.0, 0.0, 0, 0, Vector2( 0.179245, 0.584091 ), 4.91185, 4.91185, 0, 0, Vector2( 0.603774, 0.954545 ), 6.05975, 6.05975, 0, 0, Vector2( 0.806604, 0.989773 ), 0.0, 0.0, 0, 0, Vector2( 1, 0 ), 0.0, 0.0, 0, 0 ]
|
||||
|
||||
[sub_resource type="Curve" id=19]
|
||||
_data = [ Vector2( 0, 0 ), 0.0, 0.0, 0, 0, Vector2( 0.127358, 1 ), 0.0, 0.0, 0, 0, Vector2( 0.174528, 0.65 ), 0.0, 0.0, 0, 0, Vector2( 0.212264, 1 ), 0.0, 0.0, 0, 0, Vector2( 0.353774, 0.35 ), 0.0, 0.0, 0, 0, Vector2( 0.363208, 0.968182 ), 0.0, 0.0, 0, 0, Vector2( 0.485849, 0.313636 ), 0.0, 0.0, 0, 0, Vector2( 0.627358, 0.140909 ), 0.0, 0.0, 0, 0, Vector2( 0.721698, 0.259091 ), 0.0, 0.0, 0, 0, Vector2( 0.745283, 0.623864 ), 0.0, 0.0, 0, 0, Vector2( 0.872642, 0.794318 ), 0.0, 0.0, 0, 0, Vector2( 0.915094, 0.248864 ), 0.0, 0.0, 0, 0, Vector2( 0.933962, 0.5125 ), 0.0, 0.0, 0, 0, Vector2( 1, 0 ), 0.0, 0.0, 0, 0 ]
|
||||
|
||||
[sub_resource type="CapsuleShape" id=20]
|
||||
radius = 0.274866
|
||||
height = 2.75974
|
||||
|
||||
[sub_resource type="AudioStreamGenerator" id=12]
|
||||
mix_rate = 5500.0
|
||||
|
||||
[sub_resource type="Gradient" id=13]
|
||||
offsets = PoolRealArray( 0, 0.5, 1 )
|
||||
colors = PoolColorArray( 0, 0.278431, 0.270588, 1, 0.356863, 0.764706, 0.670588, 1, 1, 1, 1, 1 )
|
||||
|
@ -53,42 +49,39 @@ radial_segments = 4
|
|||
rings = 3
|
||||
|
||||
[node name="bugmobile" groups=["car"] instance=ExtResource( 2 )]
|
||||
mass = 600.0
|
||||
mass = 1900.0
|
||||
script = ExtResource( 3 )
|
||||
max_steer_angle = 16.0
|
||||
speed_steer_angle = 8.0
|
||||
max_steer_speed = 60.0
|
||||
max_steer_input = 50.0
|
||||
max_engine_force = 320.0
|
||||
max_brake_force = 95.0
|
||||
max_engine_force = 1400.0
|
||||
max_brake_force = 230.0
|
||||
throttle_power = 8000.0
|
||||
max_rpm_loss_ps = 2200.0
|
||||
base_engine_pitch = 0.65
|
||||
drag_factor = 0.85
|
||||
downforce_factor = 1.8
|
||||
gear_ratios = [ 3.5, 2.95, 2.64, 2.0, 1.67, 1.42 ]
|
||||
final_drive = 4.36
|
||||
max_rpm = 9000.0
|
||||
power_curve = SubResource( 18 )
|
||||
sound_curve = SubResource( 19 )
|
||||
|
||||
[node name="rear_left" parent="." index="0"]
|
||||
use_as_traction = true
|
||||
wheel_radius = 0.52
|
||||
wheel_rest_length = 0.47
|
||||
wheel_friction_slip = 8.0
|
||||
suspension_travel = 0.4
|
||||
suspension_stiffness = 9.0
|
||||
suspension_max_force = 7000.0
|
||||
wheel_friction_slip = 5.54
|
||||
suspension_travel = 0.35
|
||||
suspension_stiffness = 12.0
|
||||
suspension_max_force = 10000.0
|
||||
damping_compression = 0.87
|
||||
damping_relaxation = 0.9
|
||||
|
||||
[node name="front_left" parent="." index="2"]
|
||||
use_as_steering = true
|
||||
wheel_radius = 0.35
|
||||
wheel_rest_length = 0.45
|
||||
wheel_friction_slip = 7.0
|
||||
suspension_travel = 0.45
|
||||
suspension_stiffness = 12.0
|
||||
suspension_max_force = 7000.0
|
||||
wheel_rest_length = 0.47
|
||||
wheel_friction_slip = 4.45
|
||||
suspension_travel = 0.55
|
||||
suspension_stiffness = 15.0
|
||||
suspension_max_force = 15000.0
|
||||
damping_compression = 0.9
|
||||
damping_relaxation = 0.92
|
||||
|
||||
|
@ -115,11 +108,11 @@ needle_path = NodePath("speed_needle")
|
|||
[node name="front_right" parent="." index="4"]
|
||||
use_as_steering = true
|
||||
wheel_radius = 0.35
|
||||
wheel_rest_length = 0.45
|
||||
wheel_friction_slip = 7.0
|
||||
suspension_travel = 0.45
|
||||
suspension_stiffness = 12.0
|
||||
suspension_max_force = 7000.0
|
||||
wheel_rest_length = 0.47
|
||||
wheel_friction_slip = 4.45
|
||||
suspension_travel = 0.55
|
||||
suspension_stiffness = 15.0
|
||||
suspension_max_force = 15000.0
|
||||
damping_compression = 0.9
|
||||
damping_relaxation = 0.92
|
||||
|
||||
|
@ -127,10 +120,10 @@ damping_relaxation = 0.92
|
|||
use_as_traction = true
|
||||
wheel_radius = 0.52
|
||||
wheel_rest_length = 0.47
|
||||
wheel_friction_slip = 8.0
|
||||
suspension_travel = 0.4
|
||||
suspension_stiffness = 9.0
|
||||
suspension_max_force = 7000.0
|
||||
wheel_friction_slip = 5.54
|
||||
suspension_travel = 0.35
|
||||
suspension_stiffness = 12.0
|
||||
suspension_max_force = 10000.0
|
||||
damping_compression = 0.87
|
||||
damping_relaxation = 0.9
|
||||
|
||||
|
@ -140,8 +133,8 @@ shape = SubResource( 20 )
|
|||
|
||||
[node name="engine_sound_player" type="AudioStreamPlayer3D" parent="." index="7"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.791119, -2.27857 )
|
||||
stream = SubResource( 12 )
|
||||
unit_db = 14.0
|
||||
stream = ExtResource( 7 )
|
||||
pitch_scale = 0.1
|
||||
bus = "Sound"
|
||||
|
||||
[node name="Smoke" type="Particles" parent="." index="8"]
|
||||
|
@ -174,6 +167,10 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.605405, 1.5324 )
|
|||
[node name="static_follow" type="Position3D" parent="." index="16"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.88984, -4.78212 )
|
||||
|
||||
[node name="wind_sound_player" type="AudioStreamPlayer3D" parent="." index="17"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.18462, 0.791153 )
|
||||
stream = ExtResource( 8 )
|
||||
|
||||
[connection signal="brake_updated" from="." to="chassis/cockpit/brake_pedal" method="_on_value_updated"]
|
||||
[connection signal="clutch_updated" from="." to="chassis/cockpit/clutch_pedal" method="_on_value_updated"]
|
||||
[connection signal="rpm_updated" from="." to="chassis/cockpit/steering_controller/rpm_meter" method="_on_value_updated"]
|
||||
|
|
|
@ -7,24 +7,19 @@ onready var sound_playback: AudioStreamPlayback = $tire_sound_player.get_stream_
|
|||
|
||||
func _ready() -> void:
|
||||
_update_sound(1)
|
||||
# sound_player.play()
|
||||
sound_player.playing = true
|
||||
sound_player.stream_paused = true
|
||||
|
||||
|
||||
func update(skidinfo: float) -> void:
|
||||
_update_sound(skidinfo)
|
||||
if skidinfo < 0.5:
|
||||
if skidinfo < 0.25:
|
||||
emitting = true
|
||||
sound_player.stream_paused = false
|
||||
else:
|
||||
emitting = false
|
||||
sound_player.stream_paused = true
|
||||
|
||||
|
||||
func _update_sound(skidinfo: float) -> void:
|
||||
sound_player.pitch_scale = 1 + (1 - skidinfo)
|
||||
var to_fill = sound_playback.get_frames_available()
|
||||
var factor = (1 - skidinfo) * 2
|
||||
if to_fill <= 0:
|
||||
return
|
||||
while to_fill > 0:
|
||||
sound_playback.push_frame(Vector2(1.0, 1.0) * factor)
|
||||
factor += 1
|
||||
to_fill -= 1
|
||||
sound_player.pitch_scale = 1 + pow(skidinfo, 2) - skidinfo / 3
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
[gd_scene load_steps=8 format=2]
|
||||
|
||||
[ext_resource path="res://vehicles/tire_smoke.gd" type="Script" id=1]
|
||||
[ext_resource path="res://assets/tires_squal_loop.wav" type="AudioStream" id=2]
|
||||
|
||||
[sub_resource type="Curve" id=1]
|
||||
_data = [ Vector2( 0, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0.0170454 ), 0.0, 0.0, 0, 0 ]
|
||||
|
@ -25,9 +26,6 @@ material = SubResource( 4 )
|
|||
radial_segments = 4
|
||||
rings = 4
|
||||
|
||||
[sub_resource type="AudioStreamGenerator" id=6]
|
||||
mix_rate = 5000.0
|
||||
|
||||
[node name="tire_smoke" type="Particles"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.541801, 0 )
|
||||
emitting = false
|
||||
|
@ -39,8 +37,7 @@ draw_pass_1 = SubResource( 5 )
|
|||
script = ExtResource( 1 )
|
||||
|
||||
[node name="tire_sound_player" type="AudioStreamPlayer3D" parent="."]
|
||||
stream = SubResource( 6 )
|
||||
unit_db = 25.0
|
||||
unit_size = 2.0
|
||||
stream = ExtResource( 2 )
|
||||
max_db = 1.0
|
||||
bus = "Sound"
|
||||
area_mask = 2
|
||||
|
|
|
@ -12,10 +12,7 @@ signal position_updated(player_id, position)
|
|||
|
||||
enum GearRequest { NONE, UP, DOWN }
|
||||
|
||||
export(float) var max_steer_angle = 25
|
||||
export(float) var speed_steer_angle = 10
|
||||
export(float) var max_steer_speed = 100.0
|
||||
export(float) var max_steer_input = 80.0
|
||||
export(float) var max_steer_input = 30
|
||||
|
||||
export(float) var max_engine_force = 85.0
|
||||
export(float) var max_brake_force = 50.0
|
||||
|
@ -24,6 +21,9 @@ export(float) var max_rpm_loss_ps = 3000.0
|
|||
export(float) var base_engine_pitch = 0.5
|
||||
export(float) var expected_max_speed = 200
|
||||
|
||||
export(float) var drag_factor = 1.0
|
||||
export(float) var downforce_factor = 1.0
|
||||
|
||||
export(Array) var gear_ratios = [3.4, 2.5, 2.0, 1.5, 1.25]
|
||||
export(float) var reverse_ratio = -3
|
||||
export(float) var final_drive = 3.45
|
||||
|
@ -57,10 +57,8 @@ onready var rrsmoke: TireSmoke = $rr_tire_smoke
|
|||
onready var rlsmoke: TireSmoke = $rl_tire_smoke
|
||||
|
||||
onready var engine_sound_player: AudioStreamPlayer3D = $engine_sound_player
|
||||
onready var engine_sound_playback: AudioStreamPlayback = $engine_sound_player.get_stream_playback()
|
||||
onready var wind_sound_player: AudioStreamPlayer3D = $wind_sound_player
|
||||
|
||||
onready var max_steer_angle_rad: float = deg2rad(max_steer_angle)
|
||||
onready var speed_steer_angle_rad: float = deg2rad(speed_steer_angle)
|
||||
onready var max_steer_input_rad: float = deg2rad(max_steer_input)
|
||||
|
||||
onready var auto_clutch_rpm_limit = max_rpm * automatic_gear_down_threshold
|
||||
|
@ -94,6 +92,7 @@ func _ready():
|
|||
|
||||
_generate_engine_sound(0)
|
||||
engine_sound_player.play()
|
||||
wind_sound_player.play()
|
||||
|
||||
|
||||
func get_cockpit_position() -> Node:
|
||||
|
@ -203,6 +202,13 @@ func _physics_process(delta: float):
|
|||
|
||||
if GlobalSettings.auto_clutch or GlobalSettings.automatic_transmission:
|
||||
clutch_position = 1 - min(rpm, auto_clutch_rpm_limit) / auto_clutch_rpm_limit
|
||||
if throttle == 0.0 and linear_velocity.length() < 1:
|
||||
clutch_position = 1
|
||||
|
||||
apply_central_impulse(linear_velocity * -1 * drag_factor)
|
||||
apply_central_impulse(
|
||||
linear_velocity.length() * -1 * global_transform.basis.y * downforce_factor
|
||||
)
|
||||
|
||||
if gear_timer > 0:
|
||||
clutch_position = 1
|
||||
|
@ -225,6 +231,7 @@ func _physics_process(delta: float):
|
|||
var power_factor = power_curve.interpolate_baked(rpm_factor)
|
||||
|
||||
_generate_engine_sound(rpm_factor)
|
||||
_generate_wind_sound(speed)
|
||||
|
||||
# Transfer to transmission
|
||||
var transmission_input = power_factor * (1 - clutch_position) * _get_gear_ratio()
|
||||
|
@ -250,12 +257,10 @@ func _physics_process(delta: float):
|
|||
emit_signal("speed_updated", speed, speed / expected_max_speed)
|
||||
emit_signal("rpm_updated", rpm, rpm_factor)
|
||||
|
||||
var steering_input = inputs.steering
|
||||
var steering_input = inputs.steering * max_steer_input_rad
|
||||
|
||||
var steer_speed_factor = clamp(speed / max_steer_speed, 0.0, 1.0)
|
||||
|
||||
steering = steering_input * lerp(max_steer_angle_rad, speed_steer_angle_rad, steer_speed_factor)
|
||||
emit_signal("steering_updated", steering, steering / max_steer_angle_rad)
|
||||
steering = clamp(steering_input, -max_steer_input_rad, max_steer_input_rad)
|
||||
emit_signal("steering_updated", steering, steering / max_steer_input_rad)
|
||||
|
||||
emit_signal("position_updated", get_network_master(), global_transform)
|
||||
|
||||
|
@ -266,22 +271,12 @@ func _physics_process(delta: float):
|
|||
|
||||
func _generate_engine_sound(rpm_factor):
|
||||
engine_sound_player.pitch_scale = base_engine_pitch + 2 * rpm_factor
|
||||
var to_fill = engine_sound_playback.get_frames_available()
|
||||
var factor = rpm_factor
|
||||
if to_fill <= 0:
|
||||
return
|
||||
var fill_segment = 1.0 / to_fill
|
||||
var fill_percent = 0.0
|
||||
while to_fill > 0:
|
||||
engine_sound_playback.push_frame(Vector2(1.0, 1.0) * factor)
|
||||
factor += (
|
||||
cos(factor)
|
||||
* sin(factor)
|
||||
* (1 + to_fill % 2)
|
||||
* ((sound_curve.interpolate_baked(fill_percent) - 0.5) * 2)
|
||||
)
|
||||
to_fill -= 1
|
||||
fill_percent += fill_segment
|
||||
engine_sound_player.unit_db = 1 + 2 * rpm_factor
|
||||
|
||||
|
||||
func _generate_wind_sound(speed):
|
||||
wind_sound_player.pitch_scale = 1 + speed / 150
|
||||
wind_sound_player.unit_db = pow(speed, 2) / 1500 * (0.5 + drag_factor) - 20
|
||||
|
||||
|
||||
func _synchronize():
|
||||
|
|
Loading…
Reference in New Issue