diff --git a/Countdown.gd b/Countdown.gd index c7ca5b7..5d05d69 100644 --- a/Countdown.gd +++ b/Countdown.gd @@ -4,6 +4,7 @@ signal race_started export (int) var delay = 3 var timer +var time_left = delay func _ready(): @@ -12,21 +13,26 @@ func _ready(): add_child(timer) timer.wait_time = 1.0 timer.connect("timeout", self, "_timeout") - timer.start() - $Number.set_text("%d" % delay) +func start(): + set_visible(true) + time_left = delay + $Number.set_text("%d" % time_left) + timer.start() + return self + func _timeout(): #print("Timeout !") - delay -= 1 - if delay < 0: + time_left -= 1 + if time_left < 0: timer.stop() set_visible(false) - elif delay == 0: + elif time_left == 0: # Go ! $Number.set_text("GO") emit_signal("race_started") else: - $Number.set_text("%d" % delay) + $Number.set_text("%d" % time_left) \ No newline at end of file diff --git a/Gui.gd b/Gui.gd index 69c3c10..d38aa23 100644 --- a/Gui.gd +++ b/Gui.gd @@ -6,5 +6,5 @@ onready var lap_counter = get_node("Laps/Value") func _ready(): pass # Replace with function body. -func _on_TileMap_lap_completed(laps): +func _on_lap_completed(laps): lap_counter.set_text("%d" % laps) diff --git a/Main.gd b/Main.gd index 0b7cb7d..483b95a 100644 --- a/Main.gd +++ b/Main.gd @@ -1,18 +1,15 @@ extends Node -# Declare member variables here. Examples: -# var a = 2 -# var b = "text" - -# Called when the node enters the scene tree for the first time. -func _ready(): - pass - - func start_game(): - pass + print("Game starting") + $Menu.set_visible(false) + yield($Countdown.start(), "race_started") + Global.race_started = true +func pause_game(): + $Menu.set_visible(true) + Global.race_started = false -func change_track(): - """ Change the race track """ - pass \ No newline at end of file +func _input(event): + if event.is_action_pressed("ui_cancel"): + pause_game() \ No newline at end of file diff --git a/Main.tscn b/Main.tscn index dc936d4..94e4b06 100644 --- a/Main.tscn +++ b/Main.tscn @@ -1,23 +1,19 @@ -[gd_scene load_steps=7 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://Main.gd" type="Script" id=1] -[ext_resource path="res://Menu.tscn" type="PackedScene" id=2] -[ext_resource path="res://RaceTrack.tscn" type="PackedScene" id=3] -[ext_resource path="res://PlayerCar.tscn" type="PackedScene" id=4] -[ext_resource path="res://Gui.tscn" type="PackedScene" id=5] -[ext_resource path="res://Countdown.tscn" type="PackedScene" id=6] +[ext_resource path="res://RaceTrack.tscn" type="PackedScene" id=2] +[ext_resource path="res://Menu.tscn" type="PackedScene" id=3] +[ext_resource path="res://Countdown.tscn" type="PackedScene" id=4] [node name="Main" type="Node"] script = ExtResource( 1 ) -[node name="Menu" parent="." instance=ExtResource( 2 )] +[node name="RaceTrack" parent="." instance=ExtResource( 2 )] -[node name="RaceTrack" parent="." instance=ExtResource( 3 )] +[node name="Menu" parent="." instance=ExtResource( 3 )] -[node name="PlayerCar" parent="RaceTrack" instance=ExtResource( 4 )] - -[node name="GUI" parent="." instance=ExtResource( 5 )] -visible = false - -[node name="Countdown" parent="." instance=ExtResource( 6 )] +[node name="Countdown" parent="." instance=ExtResource( 4 )] visible = false +delay = 3 +[connection signal="game_started" from="Menu" to="." method="start_game"] +[connection signal="track_changed" from="Menu" to="RaceTrack" method="_on_Menu_track_changed"] diff --git a/Menu.gd b/Menu.gd index 9c21c0d..2c7329a 100644 --- a/Menu.gd +++ b/Menu.gd @@ -1,12 +1,15 @@ -extends CanvasLayer +extends Control -signal track_changed(track_idx) +signal game_started() +signal track_changed() signal skin_changed(skin) -# Declare member variables here. Examples: -# var a = 2 -# var b = "text" +enum Actions { PLAY, CHANGE_TRACK, QUIT } +var _focus = null setget _set_focus +func _set_focus(value): + _focus = value + print("New focus: ", value) # Called when the node enters the scene tree for the first time. func _ready(): pass # Replace with function body. @@ -14,3 +17,42 @@ func _ready(): # Called every frame. 'delta' is the elapsed time since the previous frame. #func _process(delta): # pass + +func _input(event): + if event is InputEventMouseButton: + if _focus != null: + if event.button_index == BUTTON_LEFT and event.pressed: + match _focus: + Actions.PLAY: + emit_signal("game_started") + Actions.CHANGE_TRACK: + emit_signal("track_changed") + Actions.QUIT: + get_tree().quit() + _focus = null + +func _on_Jouer_mouse_exited(): + get_node("Main/Jouer").set("custom_colors/font_color", Color.white) + _focus = null + + +func _on_Jouer_mouse_entered(): + get_node("Main/Jouer").set("custom_colors/font_color", Color.orange) + _set_focus(Actions.PLAY) + +func _on_Options_mouse_exited(): + get_node("Main/Options").set("custom_colors/font_color", Color.white) + _focus = null + +func _on_Options_mouse_entered(): + get_node("Main/Options").set("custom_colors/font_color", Color.orange) + _set_focus(Actions.CHANGE_TRACK) + + +func _on_Quitter_mouse_entered(): + get_node("Main/Quitter").set("custom_colors/font_color", Color.orange) + _set_focus(Actions.QUIT) + +func _on_Quitter_mouse_exited(): + get_node("Main/Quitter").set("custom_colors/font_color", Color.white) + _focus = null \ No newline at end of file diff --git a/Menu.tscn b/Menu.tscn index 285d85d..494ef80 100644 --- a/Menu.tscn +++ b/Menu.tscn @@ -10,7 +10,10 @@ size = 60 use_filter = true font_data = ExtResource( 2 ) -[node name="Menu" type="CanvasLayer"] +[node name="Menu" type="Control"] +margin_right = 1920.0 +margin_bottom = 1080.0 +mouse_filter = 1 script = ExtResource( 1 ) [node name="Title" type="Label" parent="."] @@ -39,23 +42,29 @@ margin_top = -76.9716 margin_right = 9.42896 margin_bottom = 129.028 rect_scale = Vector2( 2, 2 ) +mouse_default_cursor_shape = 9 [node name="Jouer" type="Label" parent="Main"] margin_right = 149.0 margin_bottom = 66.0 +mouse_filter = 0 custom_fonts/font = ExtResource( 3 ) -custom_colors/font_color_shadow = Color( 0.454902, 0.219608, 0.0901961, 1 ) +custom_colors/font_color = Color( 1, 1, 1, 1 ) +custom_colors/font_color_shadow = Color( 0.823529, 0.517647, 0.0823529, 1 ) custom_constants/shadow_offset_x = 2 custom_constants/shadow_offset_y = 3 text = "Jouer" align = 1 +valign = 1 [node name="Options" type="Label" parent="Main"] margin_top = 70.0 margin_right = 149.0 margin_bottom = 136.0 +mouse_filter = 0 custom_fonts/font = ExtResource( 3 ) -custom_colors/font_color_shadow = Color( 0.454902, 0.219608, 0.0901961, 1 ) +custom_colors/font_color = Color( 1, 1, 1, 1 ) +custom_colors/font_color_shadow = Color( 0.823529, 0.517647, 0.0823529, 1 ) custom_constants/shadow_offset_x = 2 custom_constants/shadow_offset_y = 3 text = "Options" @@ -65,8 +74,10 @@ align = 1 margin_top = 140.0 margin_right = 149.0 margin_bottom = 206.0 +mouse_filter = 0 custom_fonts/font = ExtResource( 3 ) -custom_colors/font_color_shadow = Color( 0.454902, 0.219608, 0.0901961, 1 ) +custom_colors/font_color = Color( 1, 1, 1, 1 ) +custom_colors/font_color_shadow = Color( 0.823529, 0.517647, 0.0823529, 1 ) custom_constants/shadow_offset_x = 2 custom_constants/shadow_offset_y = 3 text = "Quitter" @@ -81,3 +92,9 @@ margin_left = -20.0 margin_top = -20.0 margin_right = 20.0 margin_bottom = 20.0 +[connection signal="mouse_entered" from="Main/Jouer" to="." method="_on_Jouer_mouse_entered"] +[connection signal="mouse_exited" from="Main/Jouer" to="." method="_on_Jouer_mouse_exited"] +[connection signal="mouse_entered" from="Main/Options" to="." method="_on_Options_mouse_entered"] +[connection signal="mouse_exited" from="Main/Options" to="." method="_on_Options_mouse_exited"] +[connection signal="mouse_entered" from="Main/Quitter" to="." method="_on_Quitter_mouse_entered"] +[connection signal="mouse_exited" from="Main/Quitter" to="." method="_on_Quitter_mouse_exited"] diff --git a/OpponentCar.gd b/OpponentCar.gd index 0d441ff..2514832 100644 --- a/OpponentCar.gd +++ b/OpponentCar.gd @@ -8,6 +8,9 @@ func _ready(): # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): + if not Global.race_started: + return -1 + var position = get_unit_offset() position += speed * delta set_unit_offset(position) diff --git a/Player.gd b/Player.gd index a2407ec..08660de 100644 --- a/Player.gd +++ b/Player.gd @@ -1,22 +1,24 @@ extends PathFollow2D +signal lap_completed(laps) + export (float) var speed = 0.125 var position_on_track := 0.0 var target_on_track := 0.0 -# Called when the node enters the scene tree for the first time. -func _ready(): - pass # Replace with function body. - - func _process(delta): + # Check if a lap was completed + if int(position_on_track) > Global.laps: + Global.laps += 1 + emit_signal("lap_completed", Global.laps) + # Move the player until target_on_track - if target_on_track - position_on_track > 0.01: + elif target_on_track - position_on_track > 0.01: # Speed up car as the target_on_track goes further var speed_mod = int(clamp((target_on_track - position_on_track) / speed, 1.0, 4.0)) position_on_track += speed * delta * speed_mod - set_unit_offset(position_on_track) + set_unit_offset(min(position_on_track, target_on_track)) else: position_on_track = target_on_track diff --git a/RaceTrack.gd b/RaceTrack.gd index 08f8878..d9b1489 100644 --- a/RaceTrack.gd +++ b/RaceTrack.gd @@ -1,7 +1,6 @@ extends Node signal player_moved(track_offset) -signal lap_completed(laps) signal wrong_way(coords) # TODO: @@ -12,7 +11,7 @@ signal wrong_way(coords) var laps var current_cell -onready var track = TrackSelection.get_current_track() +var track = null onready var map = $TileMap func get_track_offset(coords): @@ -21,13 +20,17 @@ func get_track_offset(coords): # Called when the node enters the scene tree for the first time. func _ready(): - _reset_progress() + _reset_state() -func _reset_progress(): +func _reset_state(): + track = TrackSelection.get_current_track() laps = 0 current_cell = track[0] + func _input(event): + if not Global.race_started: + return -1 # Check if the mouse if following the tiles track if event is InputEventMouseMotion: var hover_cell = map.world_to_map(event.position) @@ -37,7 +40,6 @@ func _input(event): # Check if a lap is finished if hover_cell == track[0] and current_cell == track[-1]: laps += 1 - emit_signal("lap_completed", laps) # Check we are following the path if track[track.find(hover_cell) - 1] == current_cell: emit_signal("player_moved", laps + get_track_offset(hover_cell)) @@ -45,3 +47,11 @@ func _input(event): current_cell = hover_cell else: emit_signal("wrong_way", map.map_to_world(hover_cell)) + +func _on_Menu_track_changed(): + print("Options clicked") + TrackSelection.set_next_track() + _reset_state() + $TileMap._reset() + $TrackPath._reset() + \ No newline at end of file diff --git a/RaceTrack.tscn b/RaceTrack.tscn index 26abe79..86ebdd5 100644 --- a/RaceTrack.tscn +++ b/RaceTrack.tscn @@ -1,26 +1,26 @@ -[gd_scene load_steps=39 format=2] +[gd_scene load_steps=41 format=2] [ext_resource path="res://RaceTrack.gd" type="Script" id=1] [ext_resource path="res://assets/track_tiles/track.png" type="Texture" id=2] [ext_resource path="res://TileMap.gd" type="Script" id=3] [ext_resource path="res://TrackPath.gd" type="Script" id=4] [ext_resource path="res://OpponentCar.gd" type="Script" id=5] -[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0007.png" type="Texture" id=6] -[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0004.png" type="Texture" id=7] -[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0001.png" type="Texture" id=8] -[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0002.png" type="Texture" id=9] -[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0003.png" type="Texture" id=10] -[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0000.png" type="Texture" id=11] -[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0005.png" type="Texture" id=12] -[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0006.png" type="Texture" id=13] -[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0003.png" type="Texture" id=14] -[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0004.png" type="Texture" id=15] -[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0001.png" type="Texture" id=16] -[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0002.png" type="Texture" id=17] -[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0007.png" type="Texture" id=18] -[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0000.png" type="Texture" id=19] -[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0005.png" type="Texture" id=20] -[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0006.png" type="Texture" id=21] +[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0003.png" type="Texture" id=6] +[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0004.png" type="Texture" id=7] +[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0001.png" type="Texture" id=8] +[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0002.png" type="Texture" id=9] +[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0007.png" type="Texture" id=10] +[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0000.png" type="Texture" id=11] +[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0005.png" type="Texture" id=12] +[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/car02/car02iso_0006.png" type="Texture" id=13] +[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0007.png" type="Texture" id=14] +[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0004.png" type="Texture" id=15] +[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0001.png" type="Texture" id=16] +[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0002.png" type="Texture" id=17] +[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0003.png" type="Texture" id=18] +[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0000.png" type="Texture" id=19] +[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0005.png" type="Texture" id=20] +[ext_resource path="res://assets/2D_Car_Pack_DevilsWorkShop_V01/bus/busiso_0006.png" type="Texture" id=21] [ext_resource path="res://track1/policeCar/policeiso_0003.png" type="Texture" id=22] [ext_resource path="res://track1/policeCar/policeiso_0004.png" type="Texture" id=23] [ext_resource path="res://track1/policeCar/policeiso_0001.png" type="Texture" id=24] @@ -33,6 +33,8 @@ [ext_resource path="res://Player.gd" type="Script" id=31] [ext_resource path="res://PlayerCar.tscn" type="PackedScene" id=32] [ext_resource path="res://wrong_way.tscn" type="PackedScene" id=33] +[ext_resource path="res://Gui.tscn" type="PackedScene" id=34] +[ext_resource path="res://Gui.gd" type="Script" id=35] [sub_resource type="Gradient" id=1] colors = PoolColorArray( 0.284025, 0.4375, 0.0803223, 1, 0.30305, 0.480469, 0.0675659, 1 ) @@ -115,19 +117,19 @@ width = 1920 [sub_resource type="Curve2D" id=4] _data = { -"points": PoolVector2Array( 0, 0, 0, 0, -17.3556, 327.792, 0, 0, 0, 0, 1930.1, 452.427 ) +"points": PoolVector2Array( 0, 0, 0, 0, 606.951, 579.696, 0, 0, 0, 0, 755.584, 596.499 ) } [sub_resource type="SpriteFrames" id=5] animations = [ { "frames": [ ExtResource( 6 ), ExtResource( 7 ), ExtResource( 8 ), ExtResource( 9 ), ExtResource( 10 ), ExtResource( 11 ), ExtResource( 12 ), ExtResource( 13 ) ], "loop": true, -"name": "bus", +"name": "car", "speed": 5.0 }, { "frames": [ ExtResource( 14 ), ExtResource( 15 ), ExtResource( 16 ), ExtResource( 17 ), ExtResource( 18 ), ExtResource( 19 ), ExtResource( 20 ), ExtResource( 21 ) ], "loop": true, -"name": "car", +"name": "bus", "speed": 5.0 }, { "frames": [ ExtResource( 22 ), ExtResource( 23 ), ExtResource( 24 ), ExtResource( 25 ), ExtResource( 26 ), ExtResource( 27 ), ExtResource( 28 ), ExtResource( 29 ) ], @@ -149,7 +151,7 @@ expand = true tile_set = SubResource( 3 ) cell_size = Vector2( 128, 128 ) format = 1 -tile_data = PoolIntArray( 131079, 3, 0, 131080, 2, 0, 131081, 0, 0, 196616, 1, 0, 196617, 5, 0, 262152, 4, 0, 327688, 4, 0, 327690, 4, 0, 393224, 6, 0, 393225, 2, 0, 393226, 5, 0 ) +tile_data = PoolIntArray( 262147, 1, 0, 262148, 3, 0, 262149, 2, 0, 262150, 2, 0, 262151, 0, 0, 327683, 4, 0, 327687, 4, 0, 393219, 6, 0, 393220, 2, 0, 393221, 2, 0, 393222, 2, 0, 393223, 5, 0 ) script = ExtResource( 3 ) [node name="TrackPath" type="Path2D" parent="."] @@ -157,8 +159,8 @@ curve = SubResource( 4 ) script = ExtResource( 4 ) [node name="Opponent" type="PathFollow2D" parent="TrackPath"] -position = Vector2( -17.3556, 327.792 ) -rotation = 0.0639077 +position = Vector2( 606.951, 579.696 ) +rotation = 0.112561 script = ExtResource( 5 ) [node name="OpponentCar" type="Node2D" parent="TrackPath/Opponent"] @@ -174,8 +176,8 @@ script = ExtResource( 30 ) skin = "police" [node name="Player" type="PathFollow2D" parent="TrackPath"] -position = Vector2( -17.3556, 327.792 ) -rotation = 0.0639077 +position = Vector2( 606.951, 579.696 ) +rotation = 0.112561 script = ExtResource( 31 ) [node name="PlayerCar" parent="TrackPath/Player" instance=ExtResource( 32 )] @@ -185,5 +187,9 @@ script = null [node name="Wrong Way" parent="." instance=ExtResource( 33 )] visible = false + +[node name="GUI" parent="." instance=ExtResource( 34 )] +script = ExtResource( 35 ) [connection signal="player_moved" from="." to="TrackPath/Player" method="_on_RaceTrack_player_moved"] [connection signal="wrong_way" from="." to="Wrong Way" method="_on_RaceTrack_wrong_way"] +[connection signal="lap_completed" from="TrackPath/Player" to="GUI" method="_on_lap_completed"] diff --git a/TileMap.gd b/TileMap.gd index 2776a44..72fc50b 100644 --- a/TileMap.gd +++ b/TileMap.gd @@ -5,7 +5,10 @@ enum { LEFT, RIGHT, UP, DOWN } enum { DOWN_LEFT, DOWN_RIGHT, LEFT_RIGHT, START, UP_DOWN, UP_LEFT, UP_RIGHT } # Called when the node enters the scene tree for the first time. -func _ready(): +func _reset(): + _reload_track() + +func _reload_track(): _clear_tiles() var track = TrackSelection.get_current_track() for idx in range(track.size()): diff --git a/TrackPath.gd b/TrackPath.gd index 6a9c19c..db1ed9d 100644 --- a/TrackPath.gd +++ b/TrackPath.gd @@ -7,17 +7,19 @@ var half_size : int = tile_size / 2 onready var map = get_node("../TileMap/") # Called when the node enters the scene tree for the first time. -func _ready(): +func _reset(): var track = TrackSelection.get_current_track() _build_track(track) + $Opponent.set_offset(0.0) + $Player.set_offset(0.0) - +""" func _draw(): draw_polyline(curve.get_baked_points(), Color.chartreuse, 4.0) for idx in range(0,curve.get_point_count()): draw_circle(curve.get_point_in(idx), 2.0, Color.green) draw_circle(curve.get_point_out(idx), 2.0, Color.blue) - +""" func _build_track(tiles): """ Build the track curve given a tile path """ diff --git a/track_selection.gd b/track_selection.gd index 59b81ec..c5dcadf 100644 --- a/track_selection.gd +++ b/track_selection.gd @@ -2,16 +2,7 @@ extends Node const TRACKS_PATH = "res://assets/tracks/" -var _tracks = [ - [ Vector2(2, 1), Vector2(3, 1), Vector2(4, 1), - Vector2(4, 2), Vector2(3, 2), Vector2(2, 2), Vector2(1, 2), Vector2(1, 1), - - ], - [ Vector2(7,1), Vector2(8,1), Vector2(9,1), Vector2(9,2), Vector2(9,3), - Vector2(8,3), Vector2(7,3), Vector2(7,4), Vector2(7,5), Vector2(7,6), - Vector2(6,6), Vector2(6,5), Vector2(6,4), Vector2(6,3), Vector2(5,3), - Vector2(4,3), Vector2(4,2), Vector2(4,1), Vector2(5,1), Vector2(6,1), ], -] +var _tracks = [] var _selected : int = 1 func _ready(): @@ -19,13 +10,17 @@ func _ready(): func set_next_track(): _selected = wrapi(_selected + 1, 0, _tracks.size()) + print("set_next_track : ", _selected) + func set_previous_track(): _selected = wrapi(_selected - 1, 0, _tracks.size()) + func get_current_track(): return _tracks[_selected] + func _load_tracks(): var loaded = [] for path in _find_track_files(): @@ -64,7 +59,7 @@ func _load_from_txt(content): used_cells.remove(next) #print_debug("Loading map from txt. Starting at : ", start, " | Path : \n", path) return path - + func __find_adjacent(coords, cells): for dir in [Vector2(1,0), Vector2(0,1), Vector2(-1,0), Vector2(0,-1)]: @@ -73,6 +68,7 @@ func __find_adjacent(coords, cells): return idx return -1 + func _find_track_files(): var tracks = [] var dir = Directory.new()