diff options
author | bd <bdunahu@operationnull.com> | 2025-05-22 18:18:46 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-05-22 18:18:46 -0400 |
commit | b318529cf9c01fca4ac2e1b7c7f7fccd0be4589a (patch) | |
tree | 4554f6c14799372133fd49d7ac7688a17a55fa97 /scripts/path_tester.gd | |
parent | f9d7b55634049e0ae6533fb94e058c2a368cd49b (diff) |
Use TileMapLayer in MapGenerator to display path
Diffstat (limited to 'scripts/path_tester.gd')
-rw-r--r-- | scripts/path_tester.gd | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/scripts/path_tester.gd b/scripts/path_tester.gd deleted file mode 100644 index 5add640..0000000 --- a/scripts/path_tester.gd +++ /dev/null @@ -1,55 +0,0 @@ -extends Node2D - -@export var grid_width : int = 20 -@export var grid_height : int = 14 -@export var tile_size : int = 16 - -var _pg : PathGenerator -var path_straight_atlas_coords : Vector2i = Vector2i(8, 1) -var path_corner_atlas_coords : Vector2i = Vector2i(9, 1) -var path_empty_atlas_coords : Vector2i = Vector2i(0, 0) - -# Called when the node enters the scene tree for the first time. -func _ready() -> void: - _pg = PathGenerator.new(grid_width, grid_height) - _display_path() - -func _display_path(): - var _path : Array[Vector2i] = [] - while _path.size() < 35: - _path = _pg.generate_path() - - for i in _path: - var score : int = _pg.get_tile_score(i) - - var atlas_coords : Vector2i = path_empty_atlas_coords - var rotation : float = 0.0 - - match score: - 2, 8, 10: - atlas_coords = path_straight_atlas_coords - rotation = 90.0 - 1, 4, 5: - atlas_coords = path_straight_atlas_coords - 3: - atlas_coords = path_corner_atlas_coords - rotation = -90.0 - 6: - atlas_coords = path_corner_atlas_coords - 12: - atlas_coords = path_corner_atlas_coords - rotation = 90 - 9: - atlas_coords = path_corner_atlas_coords - rotation = 180 - - var tile : Sprite2D = Sprite2D.new() - tile.texture = TileManager.get_tile_texture(atlas_coords) - tile.global_rotation_degrees = rotation - _display_tile(tile, i) - -func _display_tile(tile : Sprite2D, pos : Vector2i): - tile.global_position = (pos * tile_size) + (Vector2i.ONE * tile_size / 2) - add_child(tile) - - |