Add bugmobile car

soundtrack
Ensar Sarajčić 2021-11-16 18:48:41 +01:00
parent be935e9f41
commit 0e684050b2
13 changed files with 1230 additions and 30 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ export_presets.cfg
.mono/
data_*/
build/
*.blend?*

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -92,4 +92,5 @@ common/enable_pause_aware_picking=true
[rendering]
quality/driver/fallback_to_gles2=true
environment/default_environment="res://default_env.tres"

View File

@ -45,33 +45,33 @@ align = 1
valign = 1
[node name="CenterContainer" type="CenterContainer" parent="MarginContainer/VSplitContainer"]
margin_top = 84.0
margin_top = 96.0
margin_right = 984.0
margin_bottom = 560.0
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VSplitContainer/CenterContainer"]
margin_left = 404.0
margin_top = 171.0
margin_right = 580.0
margin_bottom = 305.0
margin_left = 398.0
margin_top = 152.0
margin_right = 586.0
margin_bottom = 312.0
[node name="StartButton" type="Button" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
margin_right = 176.0
margin_bottom = 42.0
margin_right = 188.0
margin_bottom = 48.0
custom_fonts/font = SubResource( 2 )
text = "Start"
[node name="SettingsButton" type="Button" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
margin_top = 46.0
margin_right = 176.0
margin_bottom = 88.0
margin_top = 56.0
margin_right = 188.0
margin_bottom = 104.0
custom_fonts/font = SubResource( 2 )
text = "Settings"
[node name="ExitButton" type="Button" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
margin_top = 92.0
margin_right = 176.0
margin_bottom = 134.0
margin_top = 112.0
margin_right = 188.0
margin_bottom = 160.0
custom_fonts/font = SubResource( 2 )
text = "Exit"

View File

@ -2,11 +2,12 @@ extends Panel
const buggy = preload("res://vehicles/buggy.tscn")
const beetle = preload("res://vehicles/beetlecar.tscn")
const bugmobile = preload("res://vehicles/bugmobile.tscn")
const test_scene = preload("res://scenes/test_level.tscn")
const gui_scene = preload("res://player/gui.tscn")
func _ready() -> void:
$MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/BuggyButton.grab_focus()
$MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/BeetleButton.grab_focus()
func _on_BuggyButton_pressed() -> void:
_start_with_vehicle(buggy.instance())
@ -14,6 +15,9 @@ func _on_BuggyButton_pressed() -> void:
func _on_BeetleButton_pressed() -> void:
_start_with_vehicle(beetle.instance())
func _on_BugmobileButton_pressed() -> void:
_start_with_vehicle(bugmobile.instance())
func _start_with_vehicle(vehicle: Node) -> void:
var gui = gui_scene.instance()
var scene = test_scene.instance()

View File

@ -57,24 +57,35 @@ margin_right = 984.0
margin_bottom = 560.0
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VSplitContainer/CenterContainer"]
margin_left = 419.0
margin_top = 194.0
margin_right = 565.0
margin_bottom = 282.0
[node name="BuggyButton" type="Button" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
margin_right = 146.0
margin_bottom = 42.0
custom_fonts/font = SubResource( 2 )
text = "Buggy"
margin_left = 386.0
margin_top = 171.0
margin_right = 597.0
margin_bottom = 305.0
[node name="BeetleButton" type="Button" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
margin_top = 46.0
margin_right = 146.0
margin_bottom = 88.0
margin_right = 211.0
margin_bottom = 42.0
custom_fonts/font = SubResource( 2 )
text = "Beetle"
[node name="BuggyButton" type="Button" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
margin_top = 46.0
margin_right = 211.0
margin_bottom = 88.0
custom_fonts/font = SubResource( 2 )
text = "Buggy"
[node name="BugmobileButton" type="Button" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
margin_top = 92.0
margin_right = 211.0
margin_bottom = 134.0
custom_fonts/font = SubResource( 2 )
text = "Bugmobile"
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="MarginContainer/VSplitContainer/HSplitContainer/BackButton" to="." method="_on_BackButton_pressed"]
[connection signal="pressed" from="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/BuggyButton" to="." method="_on_BuggyButton_pressed"]
[connection signal="pressed" from="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/BeetleButton" to="." method="_on_BeetleButton_pressed"]
[connection signal="pressed" from="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/BuggyButton" to="." method="_on_BuggyButton_pressed"]
[connection signal="pressed" from="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/BugmobileButton" to="." method="_on_BugmobileButton_pressed"]

View File

@ -135,8 +135,8 @@ func _physics_process(delta: float):
engine_force = throttle * final_input * MAX_ENGINE_FORCE
var handbrake = Input.get_action_strength("handbrake")
rrwheel.brake = handbrake * MAX_BRAKE_FORCE / 2
rlwheel.brake = handbrake * MAX_BRAKE_FORCE / 2
rrwheel.brake = handbrake * MAX_BRAKE_FORCE
rlwheel.brake = handbrake * MAX_BRAKE_FORCE
var speed = wheel_rpm * 2.0 * PI * rrwheel.wheel_radius / 60.0 * 3600.0 / 1000.0
emit_signal("speed_updated", speed, speed / EXPECTED_MAX_SPEED)

View File

@ -0,0 +1,118 @@
[gd_scene load_steps=15 format=2]
[ext_resource path="res://vehicles/tire_smoke.tscn" type="PackedScene" id=1]
[ext_resource path="res://assets/bugmobile.glb" type="PackedScene" id=2]
[ext_resource path="res://vehicles/buggy.gd" type="Script" id=3]
[sub_resource type="Curve" id=18]
_data = [ Vector2( 0, 0 ), 0.0, 0.0, 0, 0, Vector2( 0.103774, 0.493182 ), 0.0, 0.0, 0, 0, Vector2( 0.339623, 0.629545 ), 0.0, 0.0, 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.783019, 0 ), 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.476136 ), 0.0, 0.0, 0, 0 ]
[sub_resource type="BoxShape" id=11]
extents = Vector3( 0.156484, 0.596214, 1.89026 )
[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 )
[sub_resource type="GradientTexture" id=14]
gradient = SubResource( 13 )
[sub_resource type="Curve" id=15]
_data = [ Vector2( 0, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0.205682 ), 0.0, 0.0, 0, 0 ]
[sub_resource type="CurveTexture" id=9]
curve = SubResource( 15 )
[sub_resource type="ParticlesMaterial" id=16]
direction = Vector3( 0, 0, -1 )
gravity = Vector3( 0, 0.2, 0 )
initial_velocity = 0.8
scale = 0.2
scale_random = 0.25
scale_curve = SubResource( 9 )
color = Color( 0.521569, 0.521569, 0.521569, 0.435294 )
color_ramp = SubResource( 14 )
[sub_resource type="SpatialMaterial" id=10]
flags_transparent = true
vertex_color_use_as_albedo = true
[sub_resource type="SphereMesh" id=17]
material = SubResource( 10 )
radial_segments = 4
rings = 3
[node name="bugmobile" instance=ExtResource( 2 )]
mass = 600.0
script = ExtResource( 3 )
MAX_ENGINE_FORCE = 400.0
MAX_BRAKE_FORCE = 80.0
THROTTLE_POWER = 7500.0
BASE_ENGINE_PITCH = 0.76
EXPECTED_MAX_SPEED = 260.0
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.55
wheel_rest_length = 0.6
wheel_friction_slip = 7.0
suspension_travel = 0.8
[node name="front_left" parent="." index="2"]
use_as_steering = true
wheel_radius = 0.35
wheel_rest_length = 0.7
wheel_friction_slip = 5.0
suspension_travel = 0.6
[node name="front_right" parent="." index="4"]
use_as_steering = true
wheel_radius = 0.35
wheel_rest_length = 0.7
wheel_friction_slip = 5.0
suspension_travel = 0.6
[node name="rear_right" parent="." index="5"]
use_as_traction = true
wheel_radius = 0.55
wheel_rest_length = 0.6
wheel_friction_slip = 7.0
suspension_travel = 0.8
[node name="CollisionShape" type="CollisionShape" parent="." index="6"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.771473, -0.625139 )
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, 0.791119, -2.27857 )
stream = SubResource( 12 )
unit_db = 14.0
[node name="Smoke" type="Particles" parent="." index="8"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.686323, -2.72067 )
local_coords = false
process_material = SubResource( 16 )
draw_pass_1 = SubResource( 17 )
[node name="fl_tire_smoke" parent="." index="9" instance=ExtResource( 1 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.377735, 0.0239591, 0.971391 )
[node name="fr_tire_smoke" parent="." index="10" instance=ExtResource( 1 )]
transform = Transform( 1, 0, 0, 0, 1, -1.50996e-07, 0, 1.50996e-07, 1, -0.338267, -0.00527258, 0.997852 )
[node name="rl_tire_smoke" parent="." index="11" instance=ExtResource( 1 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 1.18159, 0.117865, -1.93644 )
[node name="rr_tire_smoke" parent="." index="12" instance=ExtResource( 1 )]
transform = Transform( 1, 0, 0, 0, 1, -1.50996e-07, 0, 1.50996e-07, 1, -1.02536, 0.101852, -1.93766 )