diff --git a/scenes/map_04.tscn b/scenes/map_04.tscn index e7893be..6dab5c5 100644 --- a/scenes/map_04.tscn +++ b/scenes/map_04.tscn @@ -1,8 +1,7 @@ -[gd_scene load_steps=33 format=3 uid="uid://bilsj1h72s23a"] +[gd_scene load_steps=32 format=3 uid="uid://bilsj1h72s23a"] [ext_resource type="Texture2D" uid="uid://csknopg1cbqbq" path="res://sprites/background/green_gradient.png" id="2_mev6t"] [ext_resource type="Texture2D" uid="uid://5l1t6nyjn022" path="res://sprites/road/road_border.png" id="3_q2khr"] -[ext_resource type="TileSet" uid="uid://buu8w8n61kbxf" path="res://sprites/spritesheet_road/markings.tres" id="3_xmt4t"] [ext_resource type="Texture2D" uid="uid://gydxil7qf7jc" path="res://sprites/road/road_trim.png" id="5_xsnl8"] [ext_resource type="Script" path="res://scripts/roadborder.gd" id="6_50nf2"] [ext_resource type="Script" path="res://scripts/generate_road_polyon.gd" id="6_x0jfh"] @@ -52,15 +51,9 @@ position = Vector2(659, 312) scale = Vector2(0.496296, 0.496296) texture = ExtResource("2_mev6t") -[node name="markings" type="TileMapLayer" parent="."] -visible = false -z_index = 1 -tile_map_data = PackedByteArray(0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 80, 0, 0, 255, 255, 1, 0, 0, 0, 0, 0, 0, 112) -tile_set = ExtResource("3_xmt4t") - [node name="Line2D2_right" type="Line2D" parent="."] z_index = 1 -points = PackedVector2Array(89, 92, 535, 98, 770, 93, 852, 79, 912, 55, 963, 16, 1001, -29, 1049, -136, 1103, -303, 1149, -543, 1151, -636, 1147, -696, 1141, -745, 1127, -785, 1091, -809, 1053, -825, 997, -833, 944, -832, 891, -816, 850, -776, 834, -729, 827, -686, 819, -633, 804, -589, 739, -450, 702, -415, 667, -407, 632, -421, 617, -454, 616, -486, 632, -539, 669, -606, 712, -702, 730, -741, 748, -765, 762, -774, 791, -794, 832, -828, 847, -883, 847, -927, 835, -957, 809, -981, 750, -1006, 666, -1009, 585, -1004, 521, -983, 329, -949, 222, -947, 138, -951, 64, -952, -3, -957, -69, -953, -134, -938, -162, -918, -192, -889, -190, -853, -186, -835, -177, -826, -165, -819, -128, -816, -77, -811, 0, -805, 99, -793, 165, -785, 221, -779, 284, -762, 315, -737, 329, -707, 322, -666, 304, -625, 271, -590, 204, -571, 134, -566, -307, -563, -361, -572, -389, -590, -397, -617, -386, -633, -365, -641, -325, -645, -4, -617, 117, -599, 201, -596, 235, -602, 254, -616, 267, -648, 267, -676, 243, -713, 197, -747, 125, -766, -263, -804, -364, -809, -488, -801, -573, -768, -614, -715, -661, -604, -653, -534, -581, -464, -524, -429, -464, -404, -390, -382, -319, -380, -293, -380, -227, -375, -175, -383, -101, -387, -31, -392, 27, -393, 59, -390, 88, -380, 103, -371, 123, -358, 148, -351, 177, -347, 214, -348, 258, -355, 293, -364, 308, -372, 330, -384, 361, -399, 375, -413, 388, -418, 402, -414, 409, -398, 397, -384, 377, -378, 326, -360, 287, -342, 212, -331, 142, -335, 110, -348, 78, -365, 44, -376, 11, -378, -37, -380, -84, -379, -134, -376, -176, -368, -215, -361, -238, -347, -272, -326, -291, -305, -306, -284, -319, -264, -323, -232, -321, -197, -311, -161, -301, -132, -274, -101, -256, -93, -229, -81, -205, -72, -181, -58, -151, -31, -126, 3, -79, 46, -46, 81, 12, 91) +points = PackedVector2Array(89, 92, 535, 98, 770, 93, 852, 79, 1001, -29, 1049, -136, 1103, -303, 1149, -543, 1147, -696, 1091, -809, 997, -832, 891, -816, 834, -729, 804, -589, 739, -450, 667, -407, 616, -486, 669, -606, 730, -741, 791, -794, 847, -883, 835, -957, 750, -1006, 521, -983, 329, -949, 138, -951, -3, -957, -162, -918, -190, -853, -130, -817, 13, -802, 284, -762, 324, -701, 304, -625, 204, -571, -54, -553, -307, -563, -361, -572, -397, -617, -325, -645, -4, -617, 177, -601, 248, -618, 267, -676, 197, -747, 125, -766, -263, -804, -364, -809, -479, -800, -573, -768, -630, -689, -661, -604, -653, -534, -524, -429, -390, -382, -293, -380, 27, -393, 200, -363, 293, -372, 388, -418, 397, -384, 326, -360, 142, -335, -38, -371, -218, -351, -323, -232, -274, -101, -181, -58, -79, 46, 39, 94) closed = true width = 6.0 texture = ExtResource("3_q2khr") @@ -77,7 +70,7 @@ texture_mode = 1 [node name="Line2D2_left" type="Line2D" parent="."] z_index = 1 -points = PackedVector2Array(7, -241, 543, -237, 639, -230, 723, -223, 776, -225, 821, -242, 848, -269, 878, -324, 956, -476, 985, -550, 1020, -650, 1025, -688, 1020, -713, 1001, -717, 982, -714, 964, -699, 944, -657, 899, -539, 857, -433, 830, -385, 795, -351, 754, -317, 714, -315, 655, -322, 605, -336, 572, -370, 545, -416, 541, -502, 544, -557, 579, -642, 619, -726, 656, -792, 677, -825, 700, -842, 721, -858, 738, -878, 731, -900, 716, -915, 691, -917, 615, -909, 561, -897, 404, -877, 332, -876, 197, -876, -9, -883, -48, -888, -58, -884, -54, -870, -40, -866, -19, -864, 91, -868, 215, -863, 281, -854, 399, -833, 436, -817, 469, -790, 489, -759, 495, -718, 490, -671, 482, -628, 470, -593, 446, -568, 419, -551, 386, -534, 331, -513, 271, -503, 150, -488, -13, -468, -126, -459, -300, -458, -383, -468, -442, -500, -482, -538, -500, -574, -501, -611, -494, -637, -475, -669, -451, -698, -421, -716, -378, -720, -331, -721, -244, -704, 49, -670, 65, -669, 94, -666, 110, -668, 117, -677, 113, -686, 98, -690, 78, -685, 53, -680, 5, -684, -109, -702, -320, -735, -365, -737, -425, -731, -459, -714, -478, -692, -501, -658, -517, -605, -516, -561, -490, -524, -447, -488, -372, -447, -291, -443, -191, -441, -2, -453, 82, -462, 117, -461, 137, -456, 156, -442, 167, -427, 189, -418, 212, -416, 239, -418, 262, -422, 281, -432, 316, -457, 367, -494, 393, -516, 438, -534, 467, -536, 491, -533, 513, -516, 518, -487, 524, -431, 518, -370, 497, -328, 461, -283, 417, -262, 110, -259, 18, -278, -14, -289, -42, -304, -66, -311, -96, -307, -110, -291, -114, -265, -101, -240, -79, -232, -45, -220, -19, -221, -5, -230) +points = PackedVector2Array(20, -234, 543, -237, 776, -225, 848, -269, 878, -324, 956, -476, 985, -550, 1025, -688, 955, -713, 930, -692, 814, -431, 734, -328, 660, -309, 540, -340, 504, -410, 558, -557, 636, -737, 721, -858, 731, -900, 615, -909, 561, -897, 404, -877, 332, -876, 197, -876, 67, -888, -48, -888, -20, -845, 93, -854, 219, -845, 308, -841, 399, -833, 436, -817, 469, -790, 489, -759, 495, -718, 490, -671, 482, -628, 438, -575, 379, -539, 271, -503, 150, -488, -13, -468, -282, -476, -429, -538, -483, -609, -426, -686, -297, -711, -114, -689, 23, -687, 115, -682, 115, -712, -210, -735, -418, -721, -503, -653, -521, -569, -400, -481, -185, -439, 89, -448, 267, -476, 429, -520, 474, -476, 479, -400, 464, -338, 400, -275, 76, -268, -133, -252, -151, -210, -122, -179, -35, -181, 6, -225) closed = true width = 6.0 texture = ExtResource("3_q2khr") @@ -130,331 +123,331 @@ collision_mask = 4 position = Vector2(-371, -772.5) shape = SubResource("RectangleShape2D_82iti") -[node name="Node2D" type="Node2D" parent="."] +[node name="Scenery2D" type="Node2D" parent="."] z_index = 20 texture_filter = 1 position = Vector2(0, 1) -[node name="FieldsBush001" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush001" type="Sprite2D" parent="Scenery2D"] position = Vector2(-232, -43) texture = ExtResource("9_cssop") -[node name="FieldsBush002" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush002" type="Sprite2D" parent="Scenery2D"] position = Vector2(-212, 54) texture = ExtResource("10_y6sb7") -[node name="FieldsBush003" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush003" type="Sprite2D" parent="Scenery2D"] position = Vector2(-320, -339) texture = ExtResource("11_akah2") -[node name="FieldsFlower015" type="Sprite2D" parent="Node2D"] +[node name="FieldsFlower015" type="Sprite2D" parent="Scenery2D"] position = Vector2(542, -713) texture = ExtResource("27_350em") -[node name="FieldsBush004" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush004" type="Sprite2D" parent="Scenery2D"] position = Vector2(524, -282) texture = ExtResource("12_ewluu") -[node name="FieldsBush006" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush006" type="Sprite2D" parent="Scenery2D"] position = Vector2(544, -816) texture = ExtResource("13_vk8a1") -[node name="FieldsBush005" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush005" type="Sprite2D" parent="Scenery2D"] position = Vector2(-240, -844) texture = ExtResource("11_akah2") -[node name="FieldsBush007" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush007" type="Sprite2D" parent="Scenery2D"] position = Vector2(-479, -376) texture = ExtResource("9_cssop") -[node name="FieldsBush008" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush008" type="Sprite2D" parent="Scenery2D"] position = Vector2(945, -937) texture = ExtResource("14_dn0k1") -[node name="FieldsBush009" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush009" type="Sprite2D" parent="Scenery2D"] position = Vector2(1106, -152) texture = ExtResource("15_8gd6n") -[node name="FieldsBush010" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush010" type="Sprite2D" parent="Scenery2D"] position = Vector2(1190, -695) texture = ExtResource("15_8gd6n") -[node name="FieldsBush012" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush012" type="Sprite2D" parent="Scenery2D"] position = Vector2(920, -498) texture = ExtResource("10_y6sb7") -[node name="FieldsBush011" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush011" type="Sprite2D" parent="Scenery2D"] position = Vector2(400, -998) texture = ExtResource("9_cssop") -[node name="FieldsBush013" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush013" type="Sprite2D" parent="Scenery2D"] position = Vector2(518, -547) texture = ExtResource("10_y6sb7") -[node name="FieldsBush014" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush014" type="Sprite2D" parent="Scenery2D"] position = Vector2(326, -494) texture = ExtResource("10_y6sb7") -[node name="FieldsBush015" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush015" type="Sprite2D" parent="Scenery2D"] position = Vector2(871, -830) texture = ExtResource("10_y6sb7") -[node name="FieldsFlower001" type="Sprite2D" parent="Node2D"] +[node name="FieldsFlower001" type="Sprite2D" parent="Scenery2D"] position = Vector2(-45, -260) texture = ExtResource("16_1pu0v") -[node name="FieldsFlower002" type="Sprite2D" parent="Node2D"] +[node name="FieldsFlower002" type="Sprite2D" parent="Scenery2D"] position = Vector2(625, -283) texture = ExtResource("17_upcog") -[node name="FieldsFlower003" type="Sprite2D" parent="Node2D"] +[node name="FieldsFlower003" type="Sprite2D" parent="Scenery2D"] position = Vector2(639, -861) texture = ExtResource("17_upcog") -[node name="FieldsFlower004" type="Sprite2D" parent="Node2D"] +[node name="FieldsFlower004" type="Sprite2D" parent="Scenery2D"] position = Vector2(222, -455) texture = ExtResource("18_g1h7o") -[node name="FieldsFlower005" type="Sprite2D" parent="Node2D"] +[node name="FieldsFlower005" type="Sprite2D" parent="Scenery2D"] position = Vector2(-414, -267) texture = ExtResource("19_wyrhu") -[node name="FieldsFlower006" type="Sprite2D" parent="Node2D"] +[node name="FieldsFlower006" type="Sprite2D" parent="Scenery2D"] position = Vector2(1047, -28) texture = ExtResource("19_wyrhu") -[node name="FieldsFlower007" type="Sprite2D" parent="Node2D"] +[node name="FieldsFlower007" type="Sprite2D" parent="Scenery2D"] position = Vector2(848, -348) texture = ExtResource("20_yvjm8") -[node name="FieldsFlower008" type="Sprite2D" parent="Node2D"] +[node name="FieldsFlower008" type="Sprite2D" parent="Scenery2D"] position = Vector2(938, -594) texture = ExtResource("21_ioerh") -[node name="FieldsFlower009" type="Sprite2D" parent="Node2D"] -position = Vector2(263, -760) +[node name="FieldsFlower009" type="Sprite2D" parent="Scenery2D"] +position = Vector2(258, -757) texture = ExtResource("22_gkfp6") -[node name="FieldsFlower010" type="Sprite2D" parent="Node2D"] +[node name="FieldsFlower010" type="Sprite2D" parent="Scenery2D"] position = Vector2(817, -752) texture = ExtResource("23_t4usj") -[node name="FieldsFlower011" type="Sprite2D" parent="Node2D"] +[node name="FieldsFlower011" type="Sprite2D" parent="Scenery2D"] position = Vector2(-258, -363) texture = ExtResource("24_10hj3") -[node name="FieldsFlower012" type="Sprite2D" parent="Node2D"] +[node name="FieldsFlower012" type="Sprite2D" parent="Scenery2D"] position = Vector2(-368, -849) texture = ExtResource("24_10hj3") -[node name="FieldsFlower013" type="Sprite2D" parent="Node2D"] +[node name="FieldsFlower013" type="Sprite2D" parent="Scenery2D"] position = Vector2(529, -621) texture = ExtResource("25_xdd3e") -[node name="FieldsFlower014" type="Sprite2D" parent="Node2D"] +[node name="FieldsFlower014" type="Sprite2D" parent="Scenery2D"] position = Vector2(251, -970) texture = ExtResource("26_k3r3y") -[node name="FieldsFlower016" type="Sprite2D" parent="Node2D"] +[node name="FieldsFlower016" type="Sprite2D" parent="Scenery2D"] position = Vector2(296, -653) texture = ExtResource("28_263s6") -[node name="FieldsFlower017" type="Sprite2D" parent="Node2D"] +[node name="FieldsFlower017" type="Sprite2D" parent="Scenery2D"] position = Vector2(434, 168) texture = ExtResource("29_ymjhg") -[node name="FieldsFlower018" type="Sprite2D" parent="Node2D"] +[node name="FieldsFlower018" type="Sprite2D" parent="Scenery2D"] position = Vector2(17, 143) texture = ExtResource("29_ymjhg") -[node name="FieldsBush016" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush016" type="Sprite2D" parent="Scenery2D"] position = Vector2(603, 140) texture = ExtResource("30_nghlj") -[node name="FieldsBush017" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush017" type="Sprite2D" parent="Scenery2D"] position = Vector2(-794, -865) texture = ExtResource("30_nghlj") -[node name="FieldsBush019" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush019" type="Sprite2D" parent="Scenery2D"] position = Vector2(-68, -582) texture = ExtResource("15_8gd6n") -[node name="FieldsBush021" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush021" type="Sprite2D" parent="Scenery2D"] position = Vector2(-716, -830) texture = ExtResource("13_vk8a1") -[node name="FieldsBush022" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush022" type="Sprite2D" parent="Scenery2D"] position = Vector2(-719, -726) texture = ExtResource("13_vk8a1") -[node name="FieldsBush023" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush023" type="Sprite2D" parent="Scenery2D"] position = Vector2(-891, -833) texture = ExtResource("13_vk8a1") -[node name="FieldsBush024" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush024" type="Sprite2D" parent="Scenery2D"] position = Vector2(-615, -737) texture = ExtResource("10_y6sb7") -[node name="FieldsBush025" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush025" type="Sprite2D" parent="Scenery2D"] position = Vector2(-648, -490) texture = ExtResource("11_akah2") -[node name="FieldsBush026" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush026" type="Sprite2D" parent="Scenery2D"] position = Vector2(1334, -339) texture = ExtResource("12_ewluu") -[node name="FieldsBush050" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush050" type="Sprite2D" parent="Scenery2D"] position = Vector2(-1036, -848) texture = ExtResource("30_nghlj") -[node name="FieldsBush051" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush051" type="Sprite2D" parent="Scenery2D"] position = Vector2(-828, -784) texture = ExtResource("13_vk8a1") -[node name="FieldsBush052" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush052" type="Sprite2D" parent="Scenery2D"] position = Vector2(-911, -705) texture = ExtResource("13_vk8a1") -[node name="FieldsBush053" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush053" type="Sprite2D" parent="Scenery2D"] position = Vector2(-1011.5, -731.5) texture = ExtResource("13_vk8a1") -[node name="FieldsBush054" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush054" type="Sprite2D" parent="Scenery2D"] position = Vector2(-949.5, -654.5) texture = ExtResource("30_nghlj") -[node name="FieldsBush055" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush055" type="Sprite2D" parent="Scenery2D"] position = Vector2(-875.5, -602.5) texture = ExtResource("30_nghlj") -[node name="FieldsBush056" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush056" type="Sprite2D" parent="Scenery2D"] position = Vector2(-963.5, -562.5) texture = ExtResource("30_nghlj") -[node name="FieldsBush027" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush027" type="Sprite2D" parent="Scenery2D"] position = Vector2(-566, 14) texture = ExtResource("11_akah2") -[node name="FieldsBush028" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush028" type="Sprite2D" parent="Scenery2D"] position = Vector2(-784, -647) texture = ExtResource("30_nghlj") -[node name="FieldsBush018" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush018" type="Sprite2D" parent="Scenery2D"] position = Vector2(-1110, -539) texture = ExtResource("30_nghlj") -[node name="FieldsBush020" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush020" type="Sprite2D" parent="Scenery2D"] position = Vector2(-798, -555) texture = ExtResource("30_nghlj") -[node name="FieldsBush029" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush029" type="Sprite2D" parent="Scenery2D"] position = Vector2(-910, -498) texture = ExtResource("30_nghlj") -[node name="FieldsBush030" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush030" type="Sprite2D" parent="Scenery2D"] position = Vector2(-723, -480) texture = ExtResource("13_vk8a1") -[node name="FieldsBush031" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush031" type="Sprite2D" parent="Scenery2D"] position = Vector2(-1024, -426) texture = ExtResource("13_vk8a1") -[node name="FieldsBush032" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush032" type="Sprite2D" parent="Scenery2D"] position = Vector2(-822.5, -408.5) texture = ExtResource("13_vk8a1") -[node name="FieldsBush033" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush033" type="Sprite2D" parent="Scenery2D"] position = Vector2(-777.5, -311.5) texture = ExtResource("30_nghlj") -[node name="FieldsBush034" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush034" type="Sprite2D" parent="Scenery2D"] position = Vector2(-655, -259) texture = ExtResource("30_nghlj") -[node name="FieldsBush035" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush035" type="Sprite2D" parent="Scenery2D"] position = Vector2(-791.5, -219.5) texture = ExtResource("30_nghlj") -[node name="FieldsBush036" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush036" type="Sprite2D" parent="Scenery2D"] position = Vector2(-939, -364) texture = ExtResource("30_nghlj") -[node name="FieldsBush037" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush037" type="Sprite2D" parent="Scenery2D"] position = Vector2(-867.5, -302.5) texture = ExtResource("13_vk8a1") -[node name="FieldsBush038" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush038" type="Sprite2D" parent="Scenery2D"] position = Vector2(-870.5, -198.5) texture = ExtResource("13_vk8a1") -[node name="FieldsBush039" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush039" type="Sprite2D" parent="Scenery2D"] position = Vector2(-1012, -222) texture = ExtResource("13_vk8a1") -[node name="FieldsBush040" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush040" type="Sprite2D" parent="Scenery2D"] position = Vector2(-935.5, -119.5) texture = ExtResource("30_nghlj") -[node name="FieldsBush041" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush041" type="Sprite2D" parent="Scenery2D"] position = Vector2(-708, -155) texture = ExtResource("30_nghlj") -[node name="FieldsBush042" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush042" type="Sprite2D" parent="Scenery2D"] position = Vector2(-949.5, -27.5) texture = ExtResource("30_nghlj") -[node name="FieldsBush043" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush043" type="Sprite2D" parent="Scenery2D"] position = Vector2(-959, 0) texture = ExtResource("30_nghlj") -[node name="FieldsBush044" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush044" type="Sprite2D" parent="Scenery2D"] position = Vector2(-804, -75) texture = ExtResource("13_vk8a1") -[node name="FieldsBush045" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush045" type="Sprite2D" parent="Scenery2D"] position = Vector2(-825, 76) texture = ExtResource("13_vk8a1") -[node name="FieldsBush046" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush046" type="Sprite2D" parent="Scenery2D"] position = Vector2(-1028, 80) texture = ExtResource("13_vk8a1") -[node name="FieldsBush047" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush047" type="Sprite2D" parent="Scenery2D"] position = Vector2(-929, 216) texture = ExtResource("30_nghlj") -[node name="FieldsBush048" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush048" type="Sprite2D" parent="Scenery2D"] position = Vector2(-825, 184) texture = ExtResource("30_nghlj") -[node name="FieldsBush049" type="Sprite2D" parent="Node2D"] +[node name="FieldsBush049" type="Sprite2D" parent="Scenery2D"] position = Vector2(-943, 308) texture = ExtResource("30_nghlj") -[node name="FieldsFlower019" type="Sprite2D" parent="Node2D"] +[node name="FieldsFlower019" type="Sprite2D" parent="Scenery2D"] position = Vector2(604, -1057) texture = ExtResource("25_xdd3e") -[node name="FieldsFlower020" type="Sprite2D" parent="Node2D"] +[node name="FieldsFlower020" type="Sprite2D" parent="Scenery2D"] position = Vector2(537, -1036) texture = ExtResource("21_ioerh") -[node name="FieldsFlower021" type="Sprite2D" parent="Node2D"] +[node name="FieldsFlower021" type="Sprite2D" parent="Scenery2D"] position = Vector2(769, -1056) texture = ExtResource("27_350em") -[node name="FieldsFlower022" type="Sprite2D" parent="Node2D"] +[node name="FieldsFlower022" type="Sprite2D" parent="Scenery2D"] position = Vector2(309, -1003) texture = ExtResource("16_1pu0v") -[node name="FieldsFlower023" type="Sprite2D" parent="Node2D"] +[node name="FieldsFlower023" type="Sprite2D" parent="Scenery2D"] position = Vector2(462, -1092) texture = ExtResource("18_g1h7o") -[node name="FieldsFlower024" type="Sprite2D" parent="Node2D"] +[node name="FieldsFlower024" type="Sprite2D" parent="Scenery2D"] position = Vector2(65, -985) texture = ExtResource("19_wyrhu") -[node name="FieldsFlower025" type="Sprite2D" parent="Node2D"] +[node name="FieldsFlower025" type="Sprite2D" parent="Scenery2D"] position = Vector2(345, -1092) texture = ExtResource("17_upcog") diff --git a/scripts/car.gd b/scripts/car.gd index b16b675..ea72a4b 100644 --- a/scripts/car.gd +++ b/scripts/car.gd @@ -210,7 +210,12 @@ func get_input(delta:float): if distance_min void: +func _ready() -> void: var road=PackedVector2Array() road.append_array(line_road_right.points) - if line_road_right.closed: + if line_road_right.closed and line_road_right.points.size()>0: road.append(line_road_right.points[0]) #add first point again to close gap - if line_road_left.closed: + if line_road_left.closed and line_road_left.points.size()>0: road.append(line_road_left.points[0]) #add first point to close gap var reversed=PackedVector2Array(line_road_left.points) reversed.reverse() diff --git a/scripts/roadborder.gd b/scripts/roadborder.gd index 543b31b..3c423d9 100644 --- a/scripts/roadborder.gd +++ b/scripts/roadborder.gd @@ -13,6 +13,12 @@ const WEIGHT_DISTANCE_MAX=4*55 const MIN_WEIGHT_DISTANCE_FROM_CORNER=20 +#Smoothing Parameters +@export var smoothingradius=30 +@export var minsmoothingsradius=5 +@export var maxsmoothangle=175 #degrees + + # Called when the node enters the scene tree for the first time. func _ready() -> void: #var staticbody=get_child(0) #get road collision object (StaticBody2D) @@ -22,19 +28,84 @@ func _ready() -> void: staticbody=$road_l rightborder=false #is left border + + if points.size()<2: + print("Not enough points") + return + + points=smoothLine(points) + + # Add Visual extras addCaps($fitting) addWeights($weight,rightborder) addTrim($trim,rightborder) - + # Create Collision Polygon var line_poly=Geometry2D.offset_polyline(points,width/2) for poly in line_poly: var col = CollisionPolygon2D.new() col.polygon=poly staticbody.add_child(col) + ''' + var vcol = Polygon2D.new() + vcol.polygon=poly + staticbody.add_child(vcol) + ''' + +func smoothLine(points:PackedVector2Array) -> PackedVector2Array: + print("Running Smooth Line") + + var newpoints:PackedVector2Array + var lastlastpoint=null + var lastpoint=null + var pointscopy=points.duplicate() + if closed: + pointscopy.append(points[0]) #when closes, add first point to array to smooth the last before last corner + for p in pointscopy: + if lastlastpoint==null and lastpoint!=null: #p is 2nd point, lastpoint is first point + newpoints.append(lastpoint) #add first point + + if lastlastpoint!=null: # around lastpoint two points exist + smoothSegment(newpoints,lastlastpoint,lastpoint,p,smoothingradius,minsmoothingsradius,maxsmoothangle) + + lastlastpoint=lastpoint + lastpoint=p + if not closed: + newpoints.append(points[-1]) #add last point + + print( "From numpoints="+str(points.size())+" to "+str(newpoints.size())+" (+"+str(newpoints.size()-points.size())+")"+" ="+str(newpoints.size()/points.size()*100.0)+"%") + return newpoints + +func smoothSegment(pointarray:PackedVector2Array,plast,panchor,pnext,r,minr,maxsmoothangle): + print("Smooth segment r"+str(r)) + var dirlast=(plast-panchor).normalized() + var lenlast=(plast-panchor).length() + var dirnext=(pnext-panchor).normalized() + var lennext=(pnext-panchor).length() + + + if dirlast.dot(dirnext)