From 7b6e2c4cb2b2874f76efd02176707864a41b5169 Mon Sep 17 00:00:00 2001 From: Fisch Date: Mon, 30 Dec 2024 22:38:45 +0100 Subject: [PATCH] add new straight map --- scenes/map_06.tscn | 187 +++++++++++++++++++++++++++++++++++++++++++++ scenes/menu.tscn | 37 +++++---- scripts/car.gd | 6 +- 3 files changed, 213 insertions(+), 17 deletions(-) create mode 100644 scenes/map_06.tscn diff --git a/scenes/map_06.tscn b/scenes/map_06.tscn new file mode 100644 index 0000000..d5fe79f --- /dev/null +++ b/scenes/map_06.tscn @@ -0,0 +1,187 @@ +[gd_scene load_steps=18 format=3 uid="uid://ccy3rfrd1jpg1"] + +[ext_resource type="Texture2D" uid="uid://csknopg1cbqbq" path="res://sprites/background/green_gradient.png" id="1_wo3gb"] +[ext_resource type="Texture2D" uid="uid://5l1t6nyjn022" path="res://sprites/road/road_border.png" id="2_2ey0t"] +[ext_resource type="Script" path="res://scripts/roadborder.gd" id="3_yxc3j"] +[ext_resource type="Texture2D" uid="uid://gydxil7qf7jc" path="res://sprites/road/road_trim.png" id="4_lutxb"] +[ext_resource type="Script" path="res://scripts/generate_road_polyon.gd" id="5_weemp"] +[ext_resource type="Texture2D" uid="uid://ba7g1ewwchn6c" path="res://sprites/smooth_fields/fields_animal_001.png" id="6_mbvo3"] +[ext_resource type="Texture2D" uid="uid://bu1vuswjdjub3" path="res://sprites/road/road_startmarker.png" id="6_vt0h1"] +[ext_resource type="Texture2D" uid="uid://bdpm76vsgrpc0" path="res://sprites/smooth_fields/fields_animal_002.png" id="7_6ssj3"] +[ext_resource type="Texture2D" uid="uid://crb12ld3cl3lu" path="res://sprites/road/finishline.png" id="7_rldo0"] +[ext_resource type="Texture2D" uid="uid://c5yoi84wlopx6" path="res://sprites/smooth_fields/fields_bush_007.png" id="8_t7gkk"] +[ext_resource type="Texture2D" uid="uid://bqroujxkfem6w" path="res://sprites/smooth_fields/fields_bush_008.png" id="9_dl7d5"] +[ext_resource type="Texture2D" uid="uid://boj2l5gdvhjb5" path="res://sprites/smooth_fields/fields_flower_003.png" id="10_28hf3"] +[ext_resource type="Texture2D" uid="uid://7nxi48ue47ka" path="res://sprites/smooth_fields/fields_flower_002.png" id="11_pe1eu"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_dltky"] +size = Vector2(32, 128) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_uys5r"] +size = Vector2(208, 128) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_82iti"] +size = Vector2(128, 160) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_daqun"] +size = Vector2(384, 128) + +[node name="Map" type="Node"] + +[node name="CanvasLayer" type="CanvasLayer" parent="."] +layer = -1 + +[node name="Sprite2D" type="Sprite2D" parent="CanvasLayer"] +z_as_relative = false +position = Vector2(659, 312) +scale = Vector2(0.496296, 0.496296) +texture = ExtResource("1_wo3gb") + +[node name="Line2D2_right" type="Line2D" parent="."] +z_index = 1 +points = PackedVector2Array(-256, 64, 640, 64, 768, 96, 832, 160, 896, 256, 896, 416, 928, 512, 1024, 576, 1152, 608, 1280, 608, 1536, 608, 2048, 256, 2112, 160, 2144, 0, 2144, -128, 2176, -224, 2304, -256, 2432, -224, 2528, -128, 2560, 0, 2624, 64, 2816, 96, 2912, 96, 3328, 96, 3328, -256, 3168, -256, 3168, -352, 3456, -352, 3456, -480, 3584, -480, 3584, -256, 3392, -256, 3392, 96, 3360, 192, 3232, 224, 2944, 256, 2848, 288, 2784, 384, 2752, 512, 2752, 608, 2816, 704, 3040, 768, 3264, 736, 3488, 608, 3648, 416, 3712, 224, 3776, 64, 3872, 0, 4096, 0, 4352, 0, 4512, -128, 4768, 96, 5024, -96, 5248, 0, 5317, -36, 5632, 64, 5856, 160, 6080, 192, 6304, 192, 6560, 288, 6688, 448, 6880, 544, 7168, 544, 7424, 448, 7552, 288, 7712, 96, 8032, 64, 8256, 0, 8352, -160, 8352, -352, 8256, -512, 8064, -608, 7808, -640, 7520, -640, 7200, -672, 7104, -736, 7104, -832, 7136, -896, 7264, -928, 7712, -896, 8064, -768, 8352, -544, 8448, -320, 8576, -64, 8800, 32, 8992, 64, 8800, 160, 8704, 512, 8736, 704, 8864, 736, 9216, 704, 9472, 608, 9600, 448, 9664, 288, 9888, 256, 10016, 320, 10432, 288, 10688, 128, 10848, -224, 10816, -640, 10528, -896, 10528, -1344) +width = 6.0 +texture = ExtResource("2_2ey0t") +texture_mode = 1 +script = ExtResource("3_yxc3j") + +[node name="road_r" type="StaticBody2D" parent="Line2D2_right"] +collision_layer = 3 + +[node name="trim" type="Line2D" parent="Line2D2_right"] +width = 28.0 +texture = ExtResource("4_lutxb") +texture_mode = 1 + +[node name="Line2D2_left" type="Line2D" parent="."] +z_index = 1 +points = PackedVector2Array(-256, -64, 640, -64, 800, -32, 928, 64, 1024, 224, 1024, 384, 1088, 480, 1280, 512, 1504, 512, 1952, 224, 2016, 96, 2048, -64, 2080, -224, 2144, -320, 2272, -352, 2432, -320, 2592, -224, 2624, -96, 2720, -32, 2880, -32, 3232, -32, 3232, -160, 3104, -160, 3104, -416, 3392, -416, 3392, -544, 3648, -544, 3680, -448, 3680, -192, 3648, -128, 3520, -128, 3488, -96, 3488, 96, 3456, 256, 3360, 320, 3168, 352, 2944, 352, 2880, 416, 2880, 512, 3040, 576, 3264, 544, 3520, 416, 3616, 224, 3648, 32, 3776, -64, 4032, -128, 4096, -128, 4320, -128, 4512, -224, 4768, -64, 5024, -192, 5216, -128, 5419, -136, 5632, -192, 5792, -288, 6048, -384, 6336, -384, 7232, -384, 7520, -320, 7712, -224, 8000, -160, 8160, -160, 8224, -256, 8160, -384, 7968, -480, 7616, -544, 7296, -544, 7040, -608, 6912, -736, 6944, -928, 7104, -1088, 7296, -1120, 7680, -1120, 7968, -1088, 8064, -992, 8160, -800, 8352, -640, 8480, -512, 8544, -320, 8640, -160, 8736, -96, 8928, -32, 9120, 0, 9248, 160, 9120, 288, 8896, 352, 8832, 512, 8864, 640, 9056, 608, 9472, 416, 9504, -64, 9984, 96, 10176, 0, 10400, -96, 10368, -416, 10144, -704, 10144, -1344) +width = 6.0 +texture = ExtResource("2_2ey0t") +texture_mode = 1 +script = ExtResource("3_yxc3j") + +[node name="road_l" type="StaticBody2D" parent="Line2D2_left"] +collision_layer = 3 + +[node name="trim" type="Line2D" parent="Line2D2_left"] +width = 28.0 +texture = ExtResource("4_lutxb") +texture_mode = 1 + +[node name="Line2D2_right2" type="Line2D" parent="."] +z_index = 1 +points = PackedVector2Array(5728, -64, 5984, -160, 6240, -192, 6688, -192, 7072, -192, 7264, -128, 7520, -64, 7648, -32) +width = 6.0 +texture = ExtResource("2_2ey0t") +texture_mode = 1 +script = ExtResource("3_yxc3j") + +[node name="road_r" type="StaticBody2D" parent="Line2D2_right2"] +collision_layer = 3 + +[node name="trim" type="Line2D" parent="Line2D2_right2"] +width = 28.0 +texture = ExtResource("4_lutxb") +texture_mode = 1 + +[node name="Line2D2_left2" type="Line2D" parent="."] +z_index = 1 +points = PackedVector2Array(5736, -64, 5952, 0, 6272, 64, 6464, 96, 6688, 192, 6816, 352, 7072, 384, 7296, 352, 7456, 192, 7640, -32) +width = 6.0 +texture = ExtResource("2_2ey0t") +texture_mode = 1 +script = ExtResource("3_yxc3j") + +[node name="road_l" type="StaticBody2D" parent="Line2D2_left2"] +collision_layer = 3 + +[node name="trim" type="Line2D" parent="Line2D2_left2"] +width = 28.0 +texture = ExtResource("4_lutxb") +texture_mode = 1 + +[node name="Road" type="Polygon2D" parent="." node_paths=PackedStringArray("line_road_left", "line_road_right")] +color = Color(0.314316, 0.314316, 0.314316, 1) +script = ExtResource("5_weemp") +line_road_left = NodePath("../Line2D2_left") +line_road_right = NodePath("../Line2D2_right") + +[node name="area_cp0" type="Area2D" parent="."] +collision_layer = 4 +collision_mask = 4 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="area_cp0"] +position = Vector2(2272, -288) +shape = SubResource("RectangleShape2D_dltky") +debug_color = Color(0.958025, 0, 0.529392, 0.42) + +[node name="area_cp1" type="Area2D" parent="."] +collision_layer = 4 +collision_mask = 4 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="area_cp1"] +position = Vector2(5312, -64) +shape = SubResource("RectangleShape2D_uys5r") +debug_color = Color(0.371138, 0.615246, 1.54018e-06, 0.42) + +[node name="area_cp2" type="Area2D" parent="."] +collision_layer = 4 +collision_mask = 4 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="area_cp2"] +position = Vector2(8832, -16) +shape = SubResource("RectangleShape2D_82iti") +debug_color = Color(0, 0.568664, 0.85224, 0.42) + +[node name="area_finish" type="Area2D" parent="."] +collision_layer = 4 +collision_mask = 4 + +[node name="CollisionShape2D_Fin" type="CollisionShape2D" parent="area_finish"] +position = Vector2(10336, -1216) +shape = SubResource("RectangleShape2D_daqun") +debug_color = Color(1, 1, 1, 0.42) + +[node name="Scenery2D" type="Node2D" parent="."] +z_index = 20 +texture_filter = 1 +position = Vector2(0, 1) + +[node name="FieldsAnimal001" type="Sprite2D" parent="Scenery2D"] +position = Vector2(5920, -97) +texture = ExtResource("6_mbvo3") + +[node name="FieldsAnimal002" type="Sprite2D" parent="Scenery2D"] +position = Vector2(9952, 31) +texture = ExtResource("7_6ssj3") + +[node name="FieldsBush007" type="Sprite2D" parent="Scenery2D"] +position = Vector2(7136, 31) +scale = Vector2(3.16667, 3.16667) +texture = ExtResource("8_t7gkk") + +[node name="FieldsBush008" type="Sprite2D" parent="Scenery2D"] +position = Vector2(2496, 191) +scale = Vector2(6.7439, 6.7439) +texture = ExtResource("9_dl7d5") + +[node name="FieldsFlower003" type="Sprite2D" parent="Scenery2D"] +position = Vector2(288, 159) +texture = ExtResource("10_28hf3") + +[node name="FieldsFlower002" type="Sprite2D" parent="Scenery2D"] +position = Vector2(224, -129) +texture = ExtResource("11_pe1eu") + +[node name="startmarker" type="Sprite2D" parent="."] +texture = ExtResource("6_vt0h1") + +[node name="Node2D_Roadmarkings" type="Node2D" parent="."] + +[node name="line2d_start" type="Line2D" parent="Node2D_Roadmarkings"] +position = Vector2(-32, 0) +points = PackedVector2Array(128, -48, 128, 48) +width = 16.0 +texture = ExtResource("7_rldo0") +texture_mode = 1 diff --git a/scenes/menu.tscn b/scenes/menu.tscn index e47812c..f75738d 100644 --- a/scenes/menu.tscn +++ b/scenes/menu.tscn @@ -12,6 +12,21 @@ [ext_resource type="Texture2D" uid="uid://bst8p5s1sgurm" path="res://sprites/menu_bg.png" id="10_equk1"] [ext_resource type="Texture2D" uid="uid://drgqjl330tj2p" path="res://scenes/map_preview/no_preview.png" id="11_3sx36"] +[sub_resource type="Animation" id="Animation_7lydi"] +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_y58ke"] resource_name = "menu_idle" length = 60.0 @@ -29,21 +44,6 @@ tracks/0/keys = { "values": [0.0, 6.28319] } -[sub_resource type="Animation" id="Animation_7lydi"] -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_08km3"] _data = { "RESET": SubResource("Animation_7lydi"), @@ -152,7 +152,7 @@ offset_left = 613.0 offset_top = 31.0 offset_right = 1913.0 offset_bottom = 1263.0 -scale = Vector2(0.395, 0.395) +scale = Vector2(0.315, 0.315) script = ExtResource("3_c0mhk") [node name="btn_map_00" type="Button" parent="MenuDisplay/map_container"] @@ -185,6 +185,11 @@ layout_mode = 2 toggle_mode = true icon = ExtResource("11_3sx36") +[node name="btn_map_06" type="Button" parent="MenuDisplay/map_container"] +layout_mode = 2 +toggle_mode = true +icon = ExtResource("11_3sx36") + [node name="rounds_selection" type="OptionButton" parent="MenuDisplay"] offset_left = 690.0 offset_top = 556.0 diff --git a/scripts/car.gd b/scripts/car.gd index 86a7a5b..3603363 100644 --- a/scripts/car.gd +++ b/scripts/car.gd @@ -24,11 +24,13 @@ const STANDSTILLSPEED=0.5 var wheel_base = 60*0.5 var engine_power = 350 +#var engine_power = 1000 #crazy mode var applied_engine_power=0 var friction = -0.5 var drag = -0.0005 var braking = -200 +#var braking = -600 #crazy mode var max_speed_reverse = 100 var slip_speed = 150 var traction_fast = 0.05 #traction when above slip_speed @@ -39,10 +41,11 @@ var traction_slow = 0.5 var steering_speed_slow = 100 #speed for slow steering var steering_angle_slow = 50 #maximum angle slow speed -var steering_distance_far_slow=256 +var steering_distance_far_slow=25 var steering_distance_close_slow=16 var steering_speed_fast = 400 #speed for fast steering +#var steering_speed_fast = 3*400 #speed for fast steering #crazy mode var steering_angle_fast = 1 #maximum angle fast speed var steering_distance_far_fast=256 var steering_distance_close_fast=64 @@ -104,6 +107,7 @@ func _ready() -> void: func _physics_process(delta: float) -> void: + acceleration=Vector2.ZERO check_markers() get_input(delta)