From 78f3233a608d291527928a2ba7d3a17da124e318 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Sat, 20 Nov 2021 20:26:24 +0100 Subject: [PATCH] Add new track: rounding error --- menu/start_menu.gd | 4 +- scenes/rounding_error_track_level.tscn | 99 ++++++++++++++++++++++++++ scenes/test_level.tscn | 10 ++- vehicles/beetlecar.tscn | 4 +- 4 files changed, 108 insertions(+), 9 deletions(-) create mode 100644 scenes/rounding_error_track_level.tscn diff --git a/menu/start_menu.gd b/menu/start_menu.gd index b2141d0..5aed74c 100644 --- a/menu/start_menu.gd +++ b/menu/start_menu.gd @@ -5,10 +5,11 @@ const BEETLE = preload("res://vehicles/beetlecar.tscn") const BUGMOBILE = preload("res://vehicles/bugmobile.tscn") const TEST_SCENE = preload("res://scenes/test_level.tscn") const INFINITE_LOOP_SCENE = preload("res://scenes/infinite_loop_track_level.tscn") +const ROUNDING_ERROR = preload("res://scenes/rounding_error_track_level.tscn") const GUI_SCENE = preload("res://player/gui.tscn") var vehicles = [BEETLE, BUGGY, BUGMOBILE] -var tracks = [TEST_SCENE, INFINITE_LOOP_SCENE] +var tracks = [TEST_SCENE, INFINITE_LOOP_SCENE, ROUNDING_ERROR] # gdlint: ignore=max-line-length onready var vehicle_selector = $MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/VehicleSelector @@ -24,6 +25,7 @@ func _ready() -> void: track_selector.add_item("Test track") track_selector.add_item("Infinite Loop") + track_selector.add_item("Rounding Error") func _on_StartButton_pressed() -> void: diff --git a/scenes/rounding_error_track_level.tscn b/scenes/rounding_error_track_level.tscn new file mode 100644 index 0000000..370e2d7 --- /dev/null +++ b/scenes/rounding_error_track_level.tscn @@ -0,0 +1,99 @@ +[gd_scene load_steps=11 format=2] + +[ext_resource path="res://icon.png" type="Texture" id=1] +[ext_resource path="res://scenes/base_track_level.tscn" type="PackedScene" id=2] + +[sub_resource type="PlaneMesh" id=11] + +[sub_resource type="SpatialMaterial" id=12] +albedo_texture = ExtResource( 1 ) + +[sub_resource type="ConcavePolygonShape" id=13] +data = PoolVector3Array( 1, 0, 1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0, -1, 1, 0, -1 ) + +[sub_resource type="Curve3D" id=14] +_data = { +"points": PoolVector3Array( 10.4255, 3.62741, 16.6706, -10.4255, -3.62741, -16.6706, -33.0971, 3.09441, 1.77408, 0, 0, 0, 0, 0, 0, -57.093, 0, -13.8155, -22.2798, 0.0414181, 19.7139, 22.2798, -0.0414181, -19.7139, -58.3374, 0, -41.6578, -20.0737, 0.16305, 2.73921, 20.0737, -0.16305, -2.73921, -32.8028, 0.749697, -81.4305, -14.7755, 0, 2.35069, 14.7755, 0, -2.35069, 4.94635, 7.23662, -84.5424, -17.7978, 0, -2.68641, 17.7978, 0, 2.68641, 61.5006, 0, -91.6313, 0.67157, 0, -25.5212, -0.67157, 0, 25.5212, 121.293, 1.90735e-06, -70.1066, 15.0235, 0.627165, -15.8058, -15.0235, -0.627165, 15.8058, 78.6267, 0, -42.2678, -8.73099, 0, -17.4619, 8.73099, 0, 17.4619, 57.4219, 4.51235, -13.2662, 0, 0, 0, 0, 0, 0, 136.564, 5.61479, -6.73579, -19.3015, -2.15428, -5.61835, 19.3015, 2.15428, 5.61835, 183.774, 5.59447, -6.94775, 0.335724, 0, -17.462, -0.335724, 0, 17.462, 210.21, 5.87604, 64.836, 3.97235, -0.0415859, -7.46809, -3.97235, 0.0415859, 7.46809, 201.693, 2.98505, 94.8519, 14.7754, 0, 11.0815, -14.7754, 0, -11.0815, 157.616, 1.88635, 103.695, 60.6821, -0.431276, 10.8129, -60.6821, 0.431276, -10.8129, 109.521, 0, 55.4519, 16.9775, -5.83046, -18.3609, -16.9775, 5.83046, 18.3609, 58.8353, 5.93703, 84.6764, 0, 0, 0, -3.04807, -1.27833, -2.1503, -31.707, 3.888, 4.19654 ), +"tilts": PoolRealArray( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) +} + +[sub_resource type="OpenSimplexNoise" id=15] +seed = -8 +octaves = 9 +period = 10.0 +persistence = 0.49 +lacunarity = 2.04 + +[sub_resource type="NoiseTexture" id=17] +flags = 39 +seamless = true +noise = SubResource( 15 ) +noise_offset = Vector2( -1, -1 ) + +[sub_resource type="SpatialMaterial" id=16] +albedo_color = Color( 0.4, 0.301961, 0.00784314, 1 ) +albedo_texture = SubResource( 17 ) + +[sub_resource type="BoxShape" id=18] +extents = Vector3( 226.72, 25.6138, 197.933 ) + +[node name="Spatial2" instance=ExtResource( 2 )] + +[node name="Track" parent="." index="1"] +track_path = NodePath("../Path") +checkpoint_polygon = PoolVector2Array( -15, -2, -15, 10, 15, 10, 15, -2 ) + +[node name="StaticBody" type="StaticBody" parent="." index="2"] +transform = Transform( 99.9785, 0, 0, 0, 99.9785, 0, 0, 0, 99.9785, 0, 0, 0 ) + +[node name="MeshInstance" type="MeshInstance" parent="StaticBody" index="0"] +transform = Transform( 6.13726, 0, 0, 0, 6.13726, 0, 0, 0, 6.13726, 0, 0, 0 ) +mesh = SubResource( 11 ) +material/0 = SubResource( 12 ) + +[node name="CollisionShape" type="CollisionShape" parent="StaticBody" index="1"] +transform = Transform( 6.13726, 0, 0, 0, 6.13726, 0, 0, 0, 6.13726, 0, 0, 0 ) +shape = SubResource( 13 ) + +[node name="Path" type="Path" parent="." index="3"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.00166, 0 ) +curve = SubResource( 14 ) + +[node name="Road" type="CSGPolygon" parent="Path" index="0"] +use_collision = true +invert_faces = true +polygon = PoolVector2Array( -8, 0, -2, -0.1, 2, -0.1, 8, 0 ) +mode = 2 +path_node = NodePath("..") +path_interval_type = 0 +path_interval = 1.0 +path_simplify_angle = 0.0 +path_rotation = 2 +path_local = true +path_continuous_u = true +path_u_distance = 1.0 +path_joined = true +material = SubResource( 16 ) + +[node name="Slope" type="CSGPolygon" parent="Path" index="1"] +use_collision = true +polygon = PoolVector2Array( -12, -20, -10, 1.25, -8, 0.75, -8, -1, 8, -1, 8, 0.75, 10, 1.25, 12, -20 ) +mode = 2 +path_node = NodePath("..") +path_interval_type = 0 +path_interval = 1.0 +path_simplify_angle = 0.0 +path_rotation = 2 +path_local = true +path_continuous_u = true +path_u_distance = 1.0 +path_joined = true + +[node name="ResetArea" type="Area" parent="." index="4"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 81.1217, 0 ) + +[node name="CollisionShape" type="CollisionShape" parent="ResetArea" index="0"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -106.576, 0 ) +shape = SubResource( 18 ) + +[connection signal="body_entered" from="ResetArea" to="." method="_on_ResetArea_body_entered"] diff --git a/scenes/test_level.tscn b/scenes/test_level.tscn index 62fb07b..a75b1ca 100644 --- a/scenes/test_level.tscn +++ b/scenes/test_level.tscn @@ -36,13 +36,11 @@ albedo_texture = SubResource( 17 ) [node name="Spatial2" instance=ExtResource( 1 )] -[node name="PlayerSpawnLocation" parent="." index="1"] -transform = Transform( -0.951412, 0, -0.307921, 0, 1, 0, 0.307921, 0, -0.951412, -26.0175, 5.60708, 25.9637 ) - -[node name="Track" parent="." index="2"] +[node name="Track" parent="." index="1"] track_path = NodePath("../Path") +checkpoint_polygon = PoolVector2Array( -15, -2, -15, 6, 15, 6, 15, -2 ) -[node name="StaticBody" type="StaticBody" parent="." index="3"] +[node name="StaticBody" type="StaticBody" parent="." index="2"] transform = Transform( 99.9785, 0, 0, 0, 99.9785, 0, 0, 0, 99.9785, 0, 0, 0 ) [node name="MeshInstance" type="MeshInstance" parent="StaticBody" index="0"] @@ -54,7 +52,7 @@ material/0 = SubResource( 12 ) transform = Transform( 6.13726, 0, 0, 0, 6.13726, 0, 0, 0, 6.13726, 0, 0, 0 ) shape = SubResource( 13 ) -[node name="Path" type="Path" parent="." index="4"] +[node name="Path" type="Path" parent="." index="3"] curve = SubResource( 14 ) [node name="Road" type="CSGPolygon" parent="Path" index="0"] diff --git a/vehicles/beetlecar.tscn b/vehicles/beetlecar.tscn index e53fe79..ce6f38e 100644 --- a/vehicles/beetlecar.tscn +++ b/vehicles/beetlecar.tscn @@ -11,7 +11,7 @@ _data = [ Vector2( 0, 0 ), 0.0, 2.58337, 0, 1, Vector2( 0.221698, 0.572727 ), 2. _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="BoxShape" id=1] -extents = Vector3( 0.417676, 0.361785, 1.51891 ) +extents = Vector3( 0.417676, 0.306859, 1.33114 ) [sub_resource type="AudioStreamGenerator" id=2] mix_rate = 5500.0 @@ -107,7 +107,7 @@ damping_relaxation = 0.8 transform = Transform( -1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ) [node name="CollisionShape" type="CollisionShape" parent="." index="6"] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.899997, 0.205449 ) +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.954429, 0.205449 ) shape = SubResource( 1 ) [node name="engine_sound_player" type="AudioStreamPlayer3D" parent="." index="7"]