From 77b49b0b86a5f5b837081a2311098b722d94f075 Mon Sep 17 00:00:00 2001 From: Fisch Date: Wed, 13 Nov 2024 00:47:40 +0100 Subject: [PATCH] add htrohr spritesheet --- scenes/map_03.tscn | 11 +++--- scripts/car.gd | 22 +++++++++--- scripts/enginesound.gd | 3 +- sprites/spritesheet_htrohr/htrohr.png | Bin 0 -> 1966 bytes sprites/spritesheet_htrohr/htrohr.png.import | 34 ++++++++++++++++++ sprites/spritesheet_htrohr/htrohr.tres | 32 +++++++++++++++++ sprites/spritesheet_htrohr/htrohr.xcf | Bin 0 -> 12028 bytes .../{make_tilemap.sh => make_tilemap_road.sh} | 0 8 files changed, 92 insertions(+), 10 deletions(-) create mode 100644 sprites/spritesheet_htrohr/htrohr.png create mode 100644 sprites/spritesheet_htrohr/htrohr.png.import create mode 100644 sprites/spritesheet_htrohr/htrohr.tres create mode 100644 sprites/spritesheet_htrohr/htrohr.xcf rename sprites/spritesheet_road/{make_tilemap.sh => make_tilemap_road.sh} (100%) diff --git a/scenes/map_03.tscn b/scenes/map_03.tscn index b6f5304..61d2fcc 100644 --- a/scenes/map_03.tscn +++ b/scenes/map_03.tscn @@ -3,7 +3,7 @@ [ext_resource type="Texture2D" uid="uid://bu05e161cb61k" path="res://sprites/background/spritesheet_bg.png" id="1_8lp8c"] [ext_resource type="TileSet" uid="uid://beswbm12qkkxk" path="res://sprites/spritesheet_road/bg_road.tres" id="2_jv1n3"] [ext_resource type="TileSet" uid="uid://buu8w8n61kbxf" path="res://sprites/spritesheet_road/markings.tres" id="3_42xuk"] -[ext_resource type="TileSet" uid="uid://b15864hbqomim" path="res://sprites/spritesheet_road/road.tres" id="4_hpo6d"] +[ext_resource type="TileSet" uid="uid://carpfxq3rn3aa" path="res://sprites/spritesheet_htrohr/htrohr.tres" id="5_748hi"] [ext_resource type="Texture2D" uid="uid://dpuhee0x5ekud" path="res://sprites/background/spritesheet_scenery.png" id="5_lefrm"] [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_qbu02"] @@ -214,17 +214,18 @@ tile_map_data = PackedByteArray("AAD7//b/AgAHAAIAAGD4//f/AgAHAAIAAGD3//j/AgAHAAI tile_set = ExtResource("2_jv1n3") [node name="markings" type="TileMapLayer" parent="."] +visible = false z_index = 1 tile_map_data = PackedByteArray("AAAAAAAAAQAAAAAAAFAAAP//AQAAAAAAAHA=") tile_set = ExtResource("3_42xuk") [node name="road_r" type="TileMapLayer" parent="."] -tile_map_data = PackedByteArray("AAD//wAAAgABAAAAAFAAAAAAAgABAAAAAFABAAAAAgABAAAAAFAHAP//AAAGAAIAAFAHAAAAAAAHAAIAAFAGAAAAAAAHAAMAAFAFAPv/AAACAAAAAAAGAPv/AAADAAAAAAAGAPz/AAADAAEAAAAGAP3/AAACAAAAAAAHAP3/AAADAAAAAAAHAP7/AAADAAEAAAACAAAAAgABAAAAAFADAAAAAgABAAAAAFAEAAAAAgABAAAAAFAFAAAAAgABAAAAAFAFAPn/AgADAAAAAAAEAPn/AgADAAAAAGAFAPr/AgABAAAAAAADAPn/AgABAAAAACADAPj/AgABAAAAACADAPf/AgADAAAAAHAAAPf/AgADAAAAABACAPf/AgABAAAAAHABAPf/AgABAAAAAHAAAPj/AgABAAAAABAAAPn/AgABAAAAABAAAPr/AgADAAEAABAEAP3/AAAAAAQAAFADAP3/AAAAAAUAAFADAP7/AAABAAUAAFAAAPv/AgADAAAAAEABAPv/AgABAAAAAEACAPv/AgABAAAAAEADAPv/AgABAAAAAEAEAPv/AgAFAAAAAAAEAPz/AgABAAAAABACAP7/AgAGAAIAAGACAP3/AgAAAAIAACABAPz/AgAAAAIAACABAP3/AgAGAAEAACAAAPz/AgADAAIAAFD///z/AgABAAAAAHD+//z/AgABAAAAAHD9//z/AgADAAAAABD9//3/AgABAAAAADD8//3/AgABAAAAACD8//z/AgABAAAAACD8//v/AgAFAAAAAGD9//v/AgADAAAAACD9//r/AgADAAAAAHD9//7/AgAFAAAAACD8//7/AgAFAAAAADD9//n/AgADAAAAAFD9//j/AgADAAAAAAD8//j/AgAFAAAAAED7//b/AAAGAAIAAAD8//b/AAAHAAIAAAD8//f/AAAHAAMAAAD4//f/AAAHAAMAAGD3//f/AAAHAAIAAGD3//j/AAAGAAIAAGD6//b/AAADAAEAAGD5//b/AAADAAAAAGD5//f/AAACAAAAAGD8//r/AgAFAAAAADD8//n/AgAFAAAAABD3//n/AgABAAAAADD3//r/AgADAAEAADD3//v/AgADAAIAACD3//z/AgAAAAIAAFD4//z/AgAGAAIAABD4//3/AgABAAAAADD4//7/AgABAAAAADD4////AgABAAAAADD4/wAAAgADAAAAADD5/wAAAgABAAAAAFD6/wAAAgABAAAAAFD7/wAAAgABAAAAAFD8/wAAAgABAAAAAFD9/wAAAgABAAAAAFD+/wAAAgABAAAAAFAEAPr/AgAFAAAAACADAPr/AgAFAAAAADA=") -tile_set = ExtResource("4_hpo6d") +tile_map_data = PackedByteArray("AAD+/wEAAAAAAAAAAAD//wEAAAAAAAAAAAAAAAEAAAAAAAAAAAABAAEAAAAAAAAAAAACAAEAAAAAAAAAAAADAAEAAAAAAAAAAAAEAAEAAAAAAAAAAAAFAAEAAAAAAAAAAAAGAAEAAAABAAMAAFAHAAAAAAACAAMAAFAHAAEAAAABAAIAAFAGAAAAAAAAAAMAAFAJAP7/AAAAAAIAAFAJAP//AAABAAIAAFAIAP7/AAAAAAMAAFAIAP//AAACAAMAAFAIAAAAAAABAAIAAFAHAP//AAAAAAMAAFAJAP3/AAAAAAAAAFAJAPz/AAAAAAAAAFAJAPv/AAABAAMAAAAIAPr/AAAAAAIAAAAIAPv/AAAAAAMAAAAJAPr/AAABAAIAAAAHAPr/AAAAAAAAAAAGAPr/AAAAAAAAAAAFAPr/AAAAAAAAAAAEAPr/AAAAAAAAAAADAPr/AAAAAAAAAAACAPr/AAADAAAAAGACAPv/AAADAAAAAFABAPr/AAAAAAMAADABAPv/AAAAAAIAADAAAPr/AAAAAAIAAAAAAPv/AAABAAIAADD///r/AAAAAAAAAAD+//r/AAAAAAAAAAD9//r/AAAAAAAAAAD8//r/AAABAAMAAGD8//v/AAAAAAMAAGD7//r/AAABAAIAAGD7//v/AAAAAAIAAGD8////AAAAAAMAADD8/wAAAAAAAAIAADD7////AAABAAMAADD7/wAAAAABAAIAADD9/wAAAAADAAAAAAD9/wEAAAADAAAAADD7//7/AAAAAAAAAFD7//3/AAAAAAAAAFD7//z/AAAAAAAAAFA=") +tile_set = ExtResource("5_748hi") [node name="road_l" type="TileMapLayer" parent="."] -tile_map_data = PackedByteArray("AAABAP//AgABAAAAAHAAAP//AgABAAAAAHD/////AgABAAAAAHAGAP7/AAAAAAQAAFAFAP7/AAAAAAUAAFAFAP//AAABAAUAAFAFAPz/AAAGAAAAAAAFAP3/AAAGAAEAAAAGAP3/AAAHAAEAAAACAP//AgABAAAAAHADAP//AgABAAAAAHAEAP//AgABAAAAAHAFAPv/AgABAAAAABAFAPr/AgABAAAAABAFAPn/AgAFAAAAAAAEAPn/AgAFAAAAABAEAPr/AgADAAAAAFADAPr/AgADAAAAADADAPf/AgAFAAAAAHADAPn/AgABAAAAADADAPj/AgABAAAAADACAPf/AgABAAAAAFABAPf/AgABAAAAAFAAAPf/AgAFAAAAABAAAPr/AgADAAEAAAAAAPn/AgABAAAAAAAAAPj/AgABAAAAAAAAAPv/AgAFAAAAAEABAPv/AgABAAAAAGACAPv/AgABAAAAAGADAPv/AgABAAAAAGAEAPv/AgADAAAAAAAEAP3/AAAGAAIAAFAEAP7/AAAHAAIAAFADAP7/AAAHAAMAAFAEAPz/AgABAAAAAAACAP7/AgABAAAAAFABAP7/AgAFAAIAAGAAAP7/AgAAAAIAAFD///3/AgAAAAIAAFAAAP3/AgAGAAEAAFD///z/AgAEAAIAAFD+//z/AAAAAAQAABD+//3/AAAAAAUAABD9//3/AAABAAUAABD9//7/AgADAAAAAFD8//7/AgADAAAAADD8//v/AgADAAAAAGD8//r/AgADAAAAAED9//v/AgAFAAAAACD9//r/AgAFAAAAAAD8//z/AgABAAAAADD8//3/AgABAAAAADD8//n/AgADAAAAABD8//j/AgADAAAAADD9//n/AgAFAAAAAFD9//j/AgAFAAAAAHD8//f/AgAFAAAAAHD7//f/AgABAAAAAFD6//f/AAAHAAEAAGD6//j/AAAGAAEAAGD5//j/AAAGAAAAAGD4//j/AgAFAAAAAGD4//n/AgAEAAIAACD5//n/AgAAAAIAACD6//r/AgAAAAIAACD7//v/AgAAAAIAACD7//z/AgAFAAIAABD6//v/AgAGAAEAACD5//r/AgAGAAEAACD7//3/AgABAAAAACD7//7/AgABAAAAACD7////AgAFAAAAADD8////AgABAAAAAHD9////AgABAAAAAHD+////AgABAAAAAHA=") -tile_set = ExtResource("4_hpo6d") +tile_map_data = PackedByteArray("AAD+//7/AAAAAAAAAAD///7/AAAAAAAAAAAAAP7/AAAAAAAAAAABAP7/AAAAAAAAAAACAP7/AAABAAAAAAADAP7/AAAAAAAAAAAEAP7/AAAAAAAAAAAFAP7/AAAAAAAAAAAGAP7/AAABAAMAAFAHAP3/AAAAAAIAAFAHAP7/AAABAAIAAFAGAP3/AAAAAAMAAFAGAPv/AAAAAAIAAAAGAPz/AAAAAAMAAAAHAPv/AAABAAIAAAAHAPz/AAABAAMAAAAEAPv/AAADAAAAAGAFAPv/AAAAAAAAAAAEAPz/AAADAAAAAFADAPz/AAAAAAAAAAACAPz/AAAAAAAAAAABAPz/AAAAAAAAAAAAAPz/AAAAAAAAAAD///z/AAAAAAAAAAD+//z/AAAAAAAAAAD9//z/AAADAAAAAGD9//7/AAADAAAAADD9//3/AAAAAAAAAFA=") +tile_set = ExtResource("5_748hi") [node name="area_finish" type="Area2D" parent="."] collision_layer = 4 diff --git a/scripts/car.gd b/scripts/car.gd index be81119..7d448c4 100644 --- a/scripts/car.gd +++ b/scripts/car.gd @@ -12,6 +12,7 @@ var checkpointtimes :Array[float]=[] const ROAD_R_NAME="road_r" const ROAD_L_NAME="road_l" +const CAR_NAME="CharacterBody_Car" const COLLISION_SLOWDOWN_CAR=1.01 @@ -52,6 +53,15 @@ var resetcar_movingspeed=resetcar_stoppedspeed+10 #stop timer when above this sp var resetcar_distance=128 #196 is roughly when car is in the middle of a two wide road var resetcar_steerangle=120 +# other car avoidance +var avoid_car_distance_far=100 +var avoid_car_distance_close=50 +var avoid_car_steeringangle_far=0 +var avoid_car_steeringangle_close=50 +var avoid_car_mininum_space=50 #how much space RayCast_FL/R must have for avoidance to start. +var avoidance_steeringangle:float=0 #actual set steering angle to avoid car +var avoidance_turndirection:int=0 + #Effects const BURNOUT_KEEP_ON_AFTER_START=1 @@ -71,6 +81,9 @@ var burnout:float=0 #at 0 is off @onready var ray_cast_fl: RayCast2D = $RayCast_FL @onready var ray_cast_fr: RayCast2D = $RayCast_FR +@onready var ray_cast_car_fl: RayCast2D = $RayCast_Car_FL +@onready var ray_cast_car_fr: RayCast2D = $RayCast_Car_FR + @onready var reset_timer: Timer = $resetTimer @onready var ray_cast_car: RayCast2D = $RayCast_Car #for tracking markers @@ -158,7 +171,7 @@ func apply_friction(): func get_input(delta:float): - + # Check RayCast to Road const distance_inf=1000 var distance_fl=distance_inf var distance_fr=distance_inf @@ -178,9 +191,11 @@ func get_input(delta:float): var distance_min= min(distance_fl,distance_fr) + var turndirection = 1 if distance_fl(Q?P^L1*CAlT_al#xOvOzJ_4ah=#HV~=+K=%4oTJiF&S=ls6!_dUP!dw!quzUSzA zZ#RQk^JW163^?vA9{?a!LIA6S2LI^%Aasxv!ep-JFqx#t=!l?@U3>r*9Y1*7#l413 ztPR+ZcfpvT|E*JCzV}=fTi9$f=R70dn7fx&I^or+t4p zYgOA69p6z?*II^c3_Yl9Y`Pv~t24>!_6^EjKB6=7>~eTyCk21A{HHIZMrk?1HQjCn zi@&UjdQxgT+>n0Sv%x4irPkkQu~)a!oAt>>%E@Q(H$<-`I$c?}V&_)3>@#T6|EpJoNtV z0H=D9Ow;XTQA6jMIyktY~4P6oC(Dl z&)<0;wakROsTE96FZvudJ5{I>BO-+xhl~a?AQ@Yk! z+f9|*@?S9Tw5rVOM(zsWC#V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trXs}AT#C0}+xF9L@R_=w4hz%{%znl;!j8WVz{5d;0o z5LgY!HG^Q%4Lwl-FlvCuQGqc|^EzRNi;tU>S!hg{qJ|+Sz;b)m2B=gp%rm;49WdEy zCe%}h4wv;@vTIkw*&uPuwjjX>@&q1RviKR5Z5K3Wboo>)Fy|&!v?EJ^oxi+@0#(&f-QSIffA+WhPzlRsjwAK~v~af}RDeckHYR!8+O*>uV3kF5U0>W5Z;Y4tZ& de`j=^UlQ!;4RwEs@Gra`e%P|YE}6GNe*jbIgy8@H literal 0 HcmV?d00001 diff --git a/sprites/spritesheet_road/make_tilemap.sh b/sprites/spritesheet_road/make_tilemap_road.sh similarity index 100% rename from sprites/spritesheet_road/make_tilemap.sh rename to sprites/spritesheet_road/make_tilemap_road.sh