From 4181736496903b437cf098c706e86fca27733ed8 Mon Sep 17 00:00:00 2001 From: Fisch Date: Fri, 27 Dec 2024 14:39:31 +0100 Subject: [PATCH] map grid snapping --- scenes/car.tscn | 2 -- scenes/map_05.tscn | 37 +++++++++++++++++++------------------ scenes/menu.tscn | 30 +++++++++++++++--------------- scripts/roadborder.gd | 4 ++-- 4 files changed, 36 insertions(+), 37 deletions(-) diff --git a/scenes/car.tscn b/scenes/car.tscn index 8fd0ddf..0695827 100644 --- a/scenes/car.tscn +++ b/scenes/car.tscn @@ -141,14 +141,12 @@ motion_mode = 1 script = ExtResource("1_i5tet") [node name="sprite_features" type="Sprite2D" parent="CharacterBody_Car"] -visible = false z_index = 10 texture_filter = 1 scale = Vector2(0.5, 0.5) texture = ExtResource("3_k2wmt") [node name="sprite_body" type="Sprite2D" parent="CharacterBody_Car"] -visible = false z_index = 10 texture_filter = 1 scale = Vector2(0.5, 0.5) diff --git a/scenes/map_05.tscn b/scenes/map_05.tscn index 1a5fde3..7a0caa2 100644 --- a/scenes/map_05.tscn +++ b/scenes/map_05.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=10 format=3 uid="uid://cu7olkgkyy2tq"] +[gd_scene load_steps=11 format=3 uid="uid://cu7olkgkyy2tq"] [ext_resource type="Texture2D" uid="uid://csknopg1cbqbq" path="res://sprites/background/green_gradient.png" id="1_nq5g7"] [ext_resource type="Texture2D" uid="uid://5l1t6nyjn022" path="res://sprites/road/road_border.png" id="3_mivmq"] [ext_resource type="Script" path="res://scripts/roadborder.gd" id="4_8hrwh"] [ext_resource type="Texture2D" uid="uid://gydxil7qf7jc" path="res://sprites/road/road_trim.png" id="5_5a0eo"] +[ext_resource type="Texture2D" uid="uid://cakbnxin6c6ba" path="res://sprites/smooth_fields/fields_flower_006.png" id="6_0rmma"] [ext_resource type="Script" path="res://scripts/generate_road_polyon.gd" id="6_vdo8x"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_daqun"] @@ -13,10 +14,10 @@ size = Vector2(23, 178.25) size = Vector2(104.875, 118) [sub_resource type="RectangleShape2D" id="RectangleShape2D_uys5r"] -size = Vector2(23, 111) +size = Vector2(23, 128) [sub_resource type="RectangleShape2D" id="RectangleShape2D_82iti"] -size = Vector2(144.75, 60.5) +size = Vector2(144, 60.5) [node name="Map" type="Node"] @@ -31,13 +32,11 @@ texture = ExtResource("1_nq5g7") [node name="Line2D2_right" type="Line2D" parent="."] z_index = 1 -points = PackedVector2Array(-270, 217, 302, 221, 395, 201, 484, 151, 554, 93, 620, 66, 755, 58, 881, 54, 995, -14, 1049, -91, 1080, -476) +points = PackedVector2Array(-256, 256, 320, 256, 512, 192, 640, 64, 896, 64, 1024, 0, 1088, -128, 1088, -512) width = 6.0 texture = ExtResource("3_mivmq") texture_mode = 1 script = ExtResource("4_8hrwh") -smoothingradius = 50 -minsmoothingsradius = 2 [node name="road_r" type="StaticBody2D" parent="Line2D2_right"] collision_layer = 3 @@ -49,13 +48,11 @@ texture_mode = 1 [node name="Line2D2_left" type="Line2D" parent="."] z_index = 1 -points = PackedVector2Array(-276, -244, 284, -244, 417, -217, 507, -176, 603, -121, 693, -102, 819, -98, 906, -140, 952, -239, 951, -350) +points = PackedVector2Array(-256, -256, 320, -256, 512, -192, 640, -64, 832, -64, 960, -192, 960, -384) width = 6.0 texture = ExtResource("3_mivmq") texture_mode = 1 script = ExtResource("4_8hrwh") -smoothingradius = 50 -minsmoothingsradius = 2 [node name="road_l" type="StaticBody2D" parent="Line2D2_left"] collision_layer = 3 @@ -67,14 +64,12 @@ texture_mode = 1 [node name="Line2D2_left2" type="Line2D" parent="."] z_index = 1 -points = PackedVector2Array(954, -516, 955, -620, 703, -616, 696, -497, -73, -493, -347, -772, -493, -778, -494, -985, 35, -989, 122, -896, 241, -899, 820, -953, 866, -981, 879, -1041, 866, -1089, 821, -1119, 702, -1125, 585, -1116, 488, -1042, 400, -988, 288, -972, 160, -1016, 69, -1045, -522, -1048, -561, -988, -548, -902, -515, -838, -518, -453, 882, -440, 954, -509) +points = PackedVector2Array(896, -576, 896, -640, 704, -640, 704, -512, -64, -512, -320, -768, -448, -768, -448, -1024, 64, -1024, 192, -960, 384, -896, 832, -960, 896, -1024, 832, -1088, 704, -1152, 576, -1088, 512, -1024, 384, -960, 192, -1024, 64, -1088, -512, -1088, -576, -960, -512, -832, -512, -704, -576, -576, -512, -448, 768, -448, 880, -560) closed = true width = 6.0 texture = ExtResource("3_mivmq") texture_mode = 1 script = ExtResource("4_8hrwh") -smoothingradius = 50 -minsmoothingsradius = 2 [node name="road_l" type="StaticBody2D" parent="Line2D2_left2"] collision_layer = 3 @@ -86,13 +81,11 @@ texture_mode = 1 [node name="Line2D2_right3" type="Line2D" parent="."] z_index = 1 -points = PackedVector2Array(1080, -475, 1084, -743, 626, -740, 615, -573, 384, -574, 298, -605, 210, -643, -53, -645, -265, -839, -407, -848, -410, -911, -49, -911, 91, -779, 815, -822, 943, -884, 991, -974, 1001, -1075, 979, -1199, 890, -1269, 730, -1301, 541, -1293, 428, -1240, 330, -1140, 249, -1117, 134, -1124, -592, -1127, -643, -1092, -683, -1032, -686, -930, -666, -769, -670, -364, -635, -304, -560, -266, 741, -263, 877, -304, 950, -348) +points = PackedVector2Array(1088, -512, 1088, -768, 576, -768, 576, -576, 384, -574, 192, -640, -64, -640, -256, -832, -352, -896, 64, -896, 320, -768, 512, -768, 768, -832, 896, -896, 960, -960, 1024, -1088, 960, -1216, 896, -1280, 576, -1280, 448, -1216, 384, -1152, 256, -1088, 128, -1152, -640, -1152, -704, -1088, -704, -896, -640, -768, -704, -640, -704, -448, -640, -320, -512, -272, 768, -272, 864, -320, 928, -416, 960, -416, 960, -384) width = 6.0 texture = ExtResource("3_mivmq") texture_mode = 1 script = ExtResource("4_8hrwh") -smoothingradius = 50 -minsmoothingsradius = 2 [node name="road_r" type="StaticBody2D" parent="Line2D2_right3"] collision_layer = 3 @@ -128,7 +121,7 @@ collision_layer = 4 collision_mask = 4 [node name="CollisionShape2D" type="CollisionShape2D" parent="area_cp0"] -position = Vector2(777, -679) +position = Vector2(784, -704) shape = SubResource("RectangleShape2D_dltky") [node name="area_cp1" type="Area2D" parent="."] @@ -136,7 +129,7 @@ collision_layer = 4 collision_mask = 4 [node name="CollisionShape2D" type="CollisionShape2D" parent="area_cp1"] -position = Vector2(135, -837.5) +position = Vector2(32, -960) shape = SubResource("RectangleShape2D_uys5r") [node name="area_cp2" type="Area2D" parent="."] @@ -144,10 +137,18 @@ collision_layer = 4 collision_mask = 4 [node name="CollisionShape2D" type="CollisionShape2D" parent="area_cp2"] -position = Vector2(-592.375, -725) +position = Vector2(-584, -768) shape = SubResource("RectangleShape2D_82iti") [node name="Scenery2D" type="Node2D" parent="."] z_index = 20 texture_filter = 1 position = Vector2(0, 1) + +[node name="FieldsFlower006" type="Sprite2D" parent="Scenery2D"] +position = Vector2(1088, -705) +texture = ExtResource("6_0rmma") + +[node name="FieldsFlower007" type="Sprite2D" parent="Scenery2D"] +position = Vector2(1024, -769) +texture = ExtResource("6_0rmma") diff --git a/scenes/menu.tscn b/scenes/menu.tscn index bf710a8..2af1eed 100644 --- a/scenes/menu.tscn +++ b/scenes/menu.tscn @@ -18,6 +18,21 @@ shader = ExtResource("3_vry7a") shader_parameter/strength = 1.0 shader_parameter/iChannel0 = ExtResource("10_equk1") +[sub_resource type="Animation" id="Animation_l7n24"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("MenuBg:rotation") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [0.0] +} + [sub_resource type="Animation" id="Animation_hwlp0"] resource_name = "menu_idle" length = 60.0 @@ -35,21 +50,6 @@ tracks/0/keys = { "values": [0.0, -6.28319] } -[sub_resource type="Animation" id="Animation_l7n24"] -length = 0.001 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("MenuBg:rotation") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [0.0] -} - [sub_resource type="AnimationLibrary" id="AnimationLibrary_1aer6"] _data = { "RESET": SubResource("Animation_l7n24"), diff --git a/scripts/roadborder.gd b/scripts/roadborder.gd index 640d771..57c9a8e 100644 --- a/scripts/roadborder.gd +++ b/scripts/roadborder.gd @@ -14,8 +14,8 @@ const MIN_WEIGHT_DISTANCE_FROM_CORNER=20 #Smoothing Parameters -@export var smoothingradius=30 -@export var minsmoothingsradius=5 +@export var smoothingradius=32 +@export var minsmoothingsradius=8 @export var maxsmoothangle=175 #degrees