diff --git a/2d/navigation_astar_hexagonal/README.md b/2d/navigation_astar_hexagonal/README.md new file mode 100644 index 0000000000..30531e749f --- /dev/null +++ b/2d/navigation_astar_hexagonal/README.md @@ -0,0 +1,15 @@ +# Tile-based navigation on hexagonal Tilemap (2D) + +Example of using 2D navigation (tile based) on a hexagonal map, using : +- [`TileMap`](https://docs.godotengine.org/en/stable/classes/class_tilemap.html) +- [`AStar2D`](https://docs.godotengine.org/en/stable/classes/class_astar2d.html) + +Language: GDScript + +Renderer: Compatibility + +Use mouse left click to interact. + +## Screenshots + +![Screenshot](screenshots/Hexagon_Navigation_2D.png) diff --git a/2d/navigation_astar_hexagonal/astar_hex_2d.gd b/2d/navigation_astar_hexagonal/astar_hex_2d.gd new file mode 100644 index 0000000000..8c38eba339 --- /dev/null +++ b/2d/navigation_astar_hexagonal/astar_hex_2d.gd @@ -0,0 +1,28 @@ +class_name AStarHex2D +extends AStar2D + +var map: TileMap + + +# Final cost used for pathfinding would be weight * cost. +# See https://docs.godotengine.org/fr/4.x/classes/class_astar3d.html#class-astar3d +func _compute_cost(_from_id: int, _to_id: int): + return 1 + + +func _estimate_cost(_from_id: int, _to_id: int): + return 1 + +# Euclidian distance heuristic would not work on hexagonal map with global position because +# we are not using regular hexagon. +# https://github.com/godotengine/godot/issues/92338 + +#func _compute_cost( from_id:int, to_id:int ): +#var position_from = get_point_position(from_id) +#var position_to = get_point_position(to_id) +#return (position_to - position_from).length_squared() + +#func _estimate_cost( from_id:int, to_id:int ): +#var position_from = get_point_position(from_id) +#var position_to = get_point_position(to_id) +#return (position_to - position_from).length_squared() diff --git a/2d/navigation_astar_hexagonal/debug/debug_astar.gd b/2d/navigation_astar_hexagonal/debug/debug_astar.gd new file mode 100644 index 0000000000..65b9500b30 --- /dev/null +++ b/2d/navigation_astar_hexagonal/debug/debug_astar.gd @@ -0,0 +1,139 @@ +extends Node2D + +const BASE_LINE_WIDTH = 3.0 +const DRAW_COLOR: Color = Color.WHITE +const OFFSET_POSITIONS = Vector2(10, 30) +const OFFSET_WEIGHT = Vector2(10, -10) + +@export var map: Map + +var _debug_connections = false +var _debug_position = false +var _debug_weights = false +var _debug_costs = false +var _debug_path = true + +@onready var _font: Font = ThemeDB.fallback_font + + +func _process(_delta): + queue_redraw() + + +func draw_arrow(src, dst, color, width, aa = true): + var angle = 0.6 + var size_head = 20 + var head: Vector2 = (dst - src).normalized() * size_head + draw_line(src, dst - head / 2, color, width, aa) + draw_polygon( + [dst, dst - head.rotated(angle), dst - head.rotated(-angle)], [color, color, color] + ) + + +func _draw(): + if _debug_connections: + _draw_connections() + if _debug_position: + _draw_positions() + if _debug_weights: + _draw_weights() + if _debug_costs: + _draw_costs() + if _debug_path: + _draw_path() + + +func _draw_path(): + if not map._point_path: + return + var point_start: Vector2i = map._point_path[0] + var point_end: Vector2i = map._point_path[len(map._point_path) - 1] + + var last_point = point_start + for index in range(1, len(map._point_path)): + var current_point = map._point_path[index] + draw_line(last_point, current_point, DRAW_COLOR, BASE_LINE_WIDTH, true) + draw_circle(current_point, BASE_LINE_WIDTH * 2.0, DRAW_COLOR) + last_point = current_point + + +func _draw_weights(): + for id in map.astar_node.get_point_ids(): + var position_weight = map.astar_node.get_point_position(id) + var cost = map.astar_node.get_point_weight_scale(id) + draw_string( + _font, + position_weight + OFFSET_WEIGHT, + str(cost), + HORIZONTAL_ALIGNMENT_FILL, + -1, + 16, + Color.RED + ) + + +func _draw_positions(): + for id in map.astar_node.get_point_ids(): + var position_label = map.astar_node.get_point_position(id) + var position_map = map.local_to_map(map.to_local(map.astar_node.get_point_position(id))) + draw_string( + _font, + position_label + OFFSET_POSITIONS, + str(position_map), + HORIZONTAL_ALIGNMENT_FILL, + -1, + 16, + Color.RED + ) + + +func _draw_connections(): + for id in map.astar_node.get_point_ids(): + for id_con in map.astar_node.get_point_connections(id): + var position_start = map.astar_node.get_point_position(id) + var position_end = map.astar_node.get_point_position(id_con) + var direction = position_end - position_start + draw_arrow( + position_start, + position_end - direction / 4.0, + Color(0.0, 1.0, 1.0, 1.0), + BASE_LINE_WIDTH * 2, + true + ) + + +func _draw_costs(): + for id in map.astar_node.get_point_ids(): + for id_con in map.astar_node.get_point_connections(id): + var position_cost_start = map.astar_node.get_point_position(id) + var position_cost_end = map.astar_node.get_point_position(id_con) + var cost = map.astar_node._compute_cost(id, id_con) + draw_string( + _font, + (position_cost_start + position_cost_end) / 2.0, + str("%.2f" % cost), + HORIZONTAL_ALIGNMENT_CENTER, + -1, + 16, + Color.PINK + ) + + +func _on_d_path_toggled(toggled_on): + _debug_path = toggled_on + + +func _on_d_costs_toggled(toggled_on): + _debug_costs = toggled_on + + +func _on_d_positions_toggled(toggled_on): + _debug_position = toggled_on + + +func _on_d_connections_toggled(toggled_on): + _debug_connections = toggled_on + + +func _on_d_weights_toggled(toggled_on): + _debug_weights = toggled_on diff --git a/2d/navigation_astar_hexagonal/icon.svg b/2d/navigation_astar_hexagonal/icon.svg new file mode 100644 index 0000000000..503523078b --- /dev/null +++ b/2d/navigation_astar_hexagonal/icon.svg @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + 2D + diff --git a/2d/navigation_astar_hexagonal/icon.svg.import b/2d/navigation_astar_hexagonal/icon.svg.import new file mode 100644 index 0000000000..f789e6d656 --- /dev/null +++ b/2d/navigation_astar_hexagonal/icon.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://brh8t0d5w2mkc" +path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.svg" +dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/2d/navigation_astar_hexagonal/icon.webp b/2d/navigation_astar_hexagonal/icon.webp new file mode 100644 index 0000000000..c36f9d6b18 Binary files /dev/null and b/2d/navigation_astar_hexagonal/icon.webp differ diff --git a/2d/navigation_astar_hexagonal/icon.webp.import b/2d/navigation_astar_hexagonal/icon.webp.import new file mode 100644 index 0000000000..1a5d65535c --- /dev/null +++ b/2d/navigation_astar_hexagonal/icon.webp.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bnujvgksdtkex" +path="res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.webp" +dest_files=["res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/2d/navigation_astar_hexagonal/map.gd b/2d/navigation_astar_hexagonal/map.gd new file mode 100644 index 0000000000..f696843aac --- /dev/null +++ b/2d/navigation_astar_hexagonal/map.gd @@ -0,0 +1,80 @@ +class_name Map +extends TileMap + +# Private variable to not trigger on same previous paths request. +var _path_start_coords: Vector2i +var _path_end_coords: Vector2i +# Used for debug. +var _point_path = [] + +# In order to have cost function control. +@onready var astar_node = AStarHex2D.new() + + +func _ready(): + astar_node.map = self + var walkable_cells_list = astar_add_walkable_cells() + astar_connect_walkable_cells(walkable_cells_list) + + +# Need to create first astar nodes, otherwise would need to +# handle connections on not yet created nodes +# here use tilemap as source of truth (with IsObstacle and Cost custom data). +func astar_add_walkable_cells(): + var cell_array = [] + for coords in get_used_cells(0): + # Be careful about hash collision, you could use a custom indexing function + # depending on your needs (example coords.x + map_size.x * coords.y) + var id = hash(coords) + + # Be carefull about what convention you used in the position parameter (here global). + var point = to_global(map_to_local(coords)) + + var tile_data: TileData = get_cell_tile_data(0, coords) + + # We could also disable point after having created it (for runtime modification for extent). + if not tile_data or tile_data.get_custom_data("IsObstacle"): + continue + + astar_node.add_point(id, point, tile_data.get_custom_data("Cost")) + cell_array.append(id) + + return cell_array + + +# Create connections by using Tilemap get_surrounding_cells +# would work even when changing coordinate system. +func astar_connect_walkable_cells(cell_array): + for id in cell_array: + var point = astar_node.get_point_position(id) + var coords = local_to_map(to_local(point)) + for neighbor_coords in get_surrounding_cells(coords): + var neighbor_id = hash(neighbor_coords) + if astar_node.has_point(neighbor_id): + astar_node.connect_points(id, neighbor_id, false) + + +# Getter of astar result in world coordinates. +func get_astar_path(world_start, world_end): + var path_world = [] + var start_coords = local_to_map(to_local(world_start)) + var end_coords = local_to_map(to_local(world_end)) + + if _path_start_coords != start_coords or _path_end_coords != end_coords: + _path_start_coords = start_coords + _path_end_coords = end_coords + for point in _recalculate_path(): + var point_world = point + path_world.append(point_world) + + return path_world + + +func _recalculate_path(): + _point_path = [] + var start_point_index = hash(_path_start_coords) + var end_point_index = hash(_path_end_coords) + if astar_node.has_point(start_point_index) and astar_node.has_point(end_point_index): + _point_path = astar_node.get_point_path(start_point_index, end_point_index) + + return _point_path diff --git a/2d/navigation_astar_hexagonal/map.tscn b/2d/navigation_astar_hexagonal/map.tscn new file mode 100644 index 0000000000..7b352b58d2 --- /dev/null +++ b/2d/navigation_astar_hexagonal/map.tscn @@ -0,0 +1,81 @@ +[gd_scene load_steps=5 format=3 uid="uid://b0qjuoqdfotei"] + +[ext_resource type="TileSet" uid="uid://sf8jvf8i1m31" path="res://tiles/tile_set.tres" id="1_44xps"] +[ext_resource type="Script" path="res://map.gd" id="2_bpqum"] +[ext_resource type="PackedScene" uid="uid://do0vop2jrn06u" path="res://player.tscn" id="2_mgwiw"] +[ext_resource type="Script" path="res://debug/debug_astar.gd" id="4_vuylu"] + +[node name="Map" type="Node2D"] + +[node name="DebugAStar" type="Node2D" parent="." node_paths=PackedStringArray("map")] +z_index = 1 +script = ExtResource("4_vuylu") +map = NodePath("../TileMap") + +[node name="Camera2D" type="Camera2D" parent="."] +position = Vector2(506, 379) +limit_left = 0 +limit_top = 0 +limit_right = 2000 +limit_bottom = 2000 +editor_draw_limits = true + +[node name="Player" parent="." node_paths=PackedStringArray("map") instance=ExtResource("2_mgwiw")] +position = Vector2(639, 339) +map = NodePath("../TileMap") + +[node name="TileMap" type="TileMap" parent="."] +z_index = -1 +tile_set = ExtResource("1_44xps") +format = 2 +layer_0/tile_data = PackedInt32Array(65536, 65539, 2, 131072, 196611, 2, 196608, 196611, 2, 1, 196611, 2, 65537, 196611, 2, 131073, 131075, 2, 196609, 131075, 2, 2, 3, 2, 65538, 3, 2, 131074, 3, 2, 196610, 262147, 2, 262144, 196611, 2, 327680, 65539, 2, 393216, 196611, 2, 262145, 131075, 2, 327681, 196611, 2, 262146, 131075, 2, 327682, 3, 2, 3, 3, 2, 65539, 458755, 2, 131075, 131075, 2, 196611, 131075, 2, 262147, 65539, 2, 327683, 458755, 2, 4, 458755, 2, 65540, 131075, 2, 131076, 131075, 2, 196612, 131075, 2, 262148, 65539, 2, 327684, 458755, 2, 5, 458755, 2, 65541, 458755, 2, 131077, 458755, 2, 196613, 131075, 2, 262149, 458755, 2, 327685, 3, 2, 6, 3, 2, 65542, 3, 2, 131078, 458755, 2, 196614, 458755, 2, 262150, 458755, 2, 327686, 3, 2, 131079, 3, 2, 262151, 3, 2, 393219, 65539, 2, 393218, 65539, 2, 393217, 65539, 2, 0, 65539, 2, 7, 65539, 2, 65543, 65539, 2, 131080, 65539, 2, 196616, 65539, 2, 262152, 65539, 2, 327687, 3, 2, 393223, 458755, 2, 393222, 458755, 2, 393221, 458755, 2, 393220, 458755, 2, 393224, 3, 2, 196615, 3, 2, 458759, 131075, 2, 458760, 131075, 2, 393225, 131075, 2, 327688, 131075, 2, 131071, 131075, 2, 196607, 131075, 2, 262143, 131075, 2, 327679, 131075, 2, 393215, 131075, 2) +script = ExtResource("2_bpqum") + +[node name="CanvasLayer" type="CanvasLayer" parent="."] + +[node name="Control" type="Control" parent="CanvasLayer"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="PanelContainer" type="PanelContainer" parent="CanvasLayer/Control"] +layout_mode = 1 +anchors_preset = 10 +anchor_right = 1.0 +offset_bottom = 31.0 +grow_horizontal = 2 + +[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer/Control/PanelContainer"] +layout_mode = 2 + +[node name="DPath" type="CheckBox" parent="CanvasLayer/Control/PanelContainer/HBoxContainer"] +layout_mode = 2 +button_pressed = true +text = "Debug Path" + +[node name="DCosts" type="CheckBox" parent="CanvasLayer/Control/PanelContainer/HBoxContainer"] +layout_mode = 2 +text = "Debug Costs" + +[node name="DWeights" type="CheckBox" parent="CanvasLayer/Control/PanelContainer/HBoxContainer"] +layout_mode = 2 +text = "Debug Weigths" + +[node name="DPositions" type="CheckBox" parent="CanvasLayer/Control/PanelContainer/HBoxContainer"] +layout_mode = 2 +text = "Debug Positions" + +[node name="DConnections" type="CheckBox" parent="CanvasLayer/Control/PanelContainer/HBoxContainer"] +layout_mode = 2 +text = "Debug Connections" + +[connection signal="toggled" from="CanvasLayer/Control/PanelContainer/HBoxContainer/DPath" to="DebugAStar" method="_on_d_path_toggled"] +[connection signal="toggled" from="CanvasLayer/Control/PanelContainer/HBoxContainer/DCosts" to="DebugAStar" method="_on_d_costs_toggled"] +[connection signal="toggled" from="CanvasLayer/Control/PanelContainer/HBoxContainer/DWeights" to="DebugAStar" method="_on_d_weights_toggled"] +[connection signal="toggled" from="CanvasLayer/Control/PanelContainer/HBoxContainer/DPositions" to="DebugAStar" method="_on_d_positions_toggled"] +[connection signal="toggled" from="CanvasLayer/Control/PanelContainer/HBoxContainer/DConnections" to="DebugAStar" method="_on_d_connections_toggled"] diff --git a/2d/navigation_astar_hexagonal/player.gd b/2d/navigation_astar_hexagonal/player.gd new file mode 100644 index 0000000000..2f2bd15e7e --- /dev/null +++ b/2d/navigation_astar_hexagonal/player.gd @@ -0,0 +1,27 @@ +extends CharacterBody2D + +@export var map: Map +@export var speed = 400 # Move speed in pixels/sec. + +var _path_to_target: Array +var _target = null + + +func _input(event): + if event.is_action_pressed(&"click"): + _path_to_target = map.get_astar_path(global_position, get_global_mouse_position()) + if not _path_to_target.is_empty(): + global_position = _path_to_target.pop_front() + _target = null + + +func _physics_process(_delta): + if _target and position.distance_to(_target) > 10.0: + velocity = position.direction_to(_target) * speed + elif not _path_to_target.is_empty(): + _target = _path_to_target.pop_front() + else: + _target = null + velocity = Vector2.ZERO + + move_and_slide() diff --git a/2d/navigation_astar_hexagonal/player.png b/2d/navigation_astar_hexagonal/player.png new file mode 100644 index 0000000000..088335da8b Binary files /dev/null and b/2d/navigation_astar_hexagonal/player.png differ diff --git a/2d/navigation_astar_hexagonal/player.png.import b/2d/navigation_astar_hexagonal/player.png.import new file mode 100644 index 0000000000..f58dee016e --- /dev/null +++ b/2d/navigation_astar_hexagonal/player.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bueu0obvayc5a" +path="res://.godot/imported/player.png-2dd0af52de4b213777cd8c9df94c0978.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://player.png" +dest_files=["res://.godot/imported/player.png-2dd0af52de4b213777cd8c9df94c0978.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/2d/navigation_astar_hexagonal/player.tscn b/2d/navigation_astar_hexagonal/player.tscn new file mode 100644 index 0000000000..1da7303d3b --- /dev/null +++ b/2d/navigation_astar_hexagonal/player.tscn @@ -0,0 +1,23 @@ +[gd_scene load_steps=4 format=3 uid="uid://do0vop2jrn06u"] + +[ext_resource type="Script" path="res://player.gd" id="1_ll2ww"] +[ext_resource type="Texture2D" uid="uid://bueu0obvayc5a" path="res://player.png" id="2_64a55"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_r2ou3"] +radius = 24.1868 + +[node name="Player" type="CharacterBody2D"] +z_index = 1 +motion_mode = 1 +platform_on_leave = 2 +script = ExtResource("1_ll2ww") + +[node name="Sprite" type="Sprite2D" parent="."] +z_index = 1 +texture_repeat = 1 +texture = ExtResource("2_64a55") +region_rect = Rect2(0, 0, 32, 32) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource("CircleShape2D_r2ou3") +disabled = true diff --git a/2d/navigation_astar_hexagonal/project.godot b/2d/navigation_astar_hexagonal/project.godot new file mode 100644 index 0000000000..08072aa486 --- /dev/null +++ b/2d/navigation_astar_hexagonal/project.godot @@ -0,0 +1,37 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=5 + +[application] + +config/name="Navigation_Astar_Hexagonal" +config/description="Demo for using 2D navigation (tile based) on a hexagonal map." +config/version="1.0.0" +config/tags=PackedStringArray("2d", "demo", "navigation", "tilemap") +run/main_scene="res://map.tscn" +config/features=PackedStringArray("4.2", "Forward Plus") +config/icon="res://icon.webp" + +[display] + +window/size/viewport_width=1280 +window/size/viewport_height=720 + +[input] + +click={ +"deadzone": 0.5, +"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(255, 7),"global_position":Vector2(259, 48),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null) +] +} + +[rendering] + +renderer/rendering_method="gl_compatibility" +renderer/rendering_method.mobile="gl_compatibility" diff --git a/2d/navigation_astar_hexagonal/screenshots/.gdignore b/2d/navigation_astar_hexagonal/screenshots/.gdignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/2d/navigation_astar_hexagonal/screenshots/Hexagon_Navigation_2D.png b/2d/navigation_astar_hexagonal/screenshots/Hexagon_Navigation_2D.png new file mode 100644 index 0000000000..ca8a889acc Binary files /dev/null and b/2d/navigation_astar_hexagonal/screenshots/Hexagon_Navigation_2D.png differ diff --git a/2d/navigation_astar_hexagonal/tiles/hexagonal_tiles_albedo.png b/2d/navigation_astar_hexagonal/tiles/hexagonal_tiles_albedo.png new file mode 100644 index 0000000000..f48fed5a34 Binary files /dev/null and b/2d/navigation_astar_hexagonal/tiles/hexagonal_tiles_albedo.png differ diff --git a/2d/navigation_astar_hexagonal/tiles/hexagonal_tiles_albedo.png.import b/2d/navigation_astar_hexagonal/tiles/hexagonal_tiles_albedo.png.import new file mode 100644 index 0000000000..1d7f7bbdf2 --- /dev/null +++ b/2d/navigation_astar_hexagonal/tiles/hexagonal_tiles_albedo.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://byswx0pgv74n6" +path="res://.godot/imported/hexagonal_tiles_albedo.png-18971f433cf6e624efaf9291906b4a02.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://tiles/hexagonal_tiles_albedo.png" +dest_files=["res://.godot/imported/hexagonal_tiles_albedo.png-18971f433cf6e624efaf9291906b4a02.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/2d/navigation_astar_hexagonal/tiles/tile_set.tres b/2d/navigation_astar_hexagonal/tiles/tile_set.tres new file mode 100644 index 0000000000..42eaafe68f --- /dev/null +++ b/2d/navigation_astar_hexagonal/tiles/tile_set.tres @@ -0,0 +1,93 @@ +[gd_resource type="TileSet" load_steps=3 format=3 uid="uid://sf8jvf8i1m31"] + +[ext_resource type="Texture2D" uid="uid://byswx0pgv74n6" path="res://tiles/hexagonal_tiles_albedo.png" id="1_4glg6"] + +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_82xe3"] +texture = ExtResource("1_4glg6") +margins = Vector2i(0, 64) +texture_region_size = Vector2i(128, 128) +0:2/0 = 0 +0:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) +0:2/0/physics_layer_0/angular_velocity = 0.0 +0:2/0/custom_data_0 = true +0:2/0/custom_data_1 = 1.0 +1:2/0 = 0 +1:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) +1:2/0/physics_layer_0/angular_velocity = 0.0 +1:2/0/custom_data_1 = 1.0 +2:2/0 = 0 +2:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) +2:2/0/physics_layer_0/angular_velocity = 0.0 +2:2/0/custom_data_1 = 1.0 +3:2/0 = 0 +3:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) +3:2/0/physics_layer_0/angular_velocity = 0.0 +3:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(0, -64, -64, -32, -64, 32, 0, 64, 64, 32, 64, -32) +3:2/0/custom_data_0 = true +3:2/0/custom_data_1 = 1.0 +4:2/0 = 0 +4:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) +4:2/0/physics_layer_0/angular_velocity = 0.0 +4:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(0, -64, -64, -32, -64, 32, 0, 64, 64, 32, 64, -32) +4:2/0/custom_data_0 = true +4:2/0/custom_data_1 = 1.0 +5:2/0 = 0 +5:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) +5:2/0/physics_layer_0/angular_velocity = 0.0 +5:2/0/custom_data_0 = true +5:2/0/custom_data_1 = 1.0 +6:2/0 = 0 +6:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) +6:2/0/physics_layer_0/angular_velocity = 0.0 +6:2/0/custom_data_0 = true +6:2/0/custom_data_1 = 1.0 +7:2/0 = 0 +7:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) +7:2/0/physics_layer_0/angular_velocity = 0.0 +7:2/0/custom_data_1 = 10.0 +0:4/0 = 0 +0:4/0/physics_layer_0/linear_velocity = Vector2(0, 0) +0:4/0/physics_layer_0/angular_velocity = 0.0 +0:4/0/custom_data_1 = 1.0 +1:4/0 = 0 +1:4/0/physics_layer_0/linear_velocity = Vector2(0, 0) +1:4/0/physics_layer_0/angular_velocity = 0.0 +1:4/0/custom_data_1 = 1.0 +2:4/0 = 0 +2:4/0/physics_layer_0/linear_velocity = Vector2(0, 0) +2:4/0/physics_layer_0/angular_velocity = 0.0 +2:4/0/custom_data_1 = 1.0 +3:4/0 = 0 +3:4/0/physics_layer_0/linear_velocity = Vector2(0, 0) +3:4/0/physics_layer_0/angular_velocity = 0.0 +3:4/0/custom_data_1 = 1.0 +4:4/0 = 0 +4:4/0/physics_layer_0/linear_velocity = Vector2(0, 0) +4:4/0/physics_layer_0/angular_velocity = 0.0 +4:4/0/custom_data_1 = 1.0 +5:4/0 = 0 +5:4/0/physics_layer_0/linear_velocity = Vector2(0, 0) +5:4/0/physics_layer_0/angular_velocity = 0.0 +5:4/0/custom_data_1 = 1.0 +6:4/0 = 0 +6:4/0/physics_layer_0/linear_velocity = Vector2(0, 0) +6:4/0/physics_layer_0/angular_velocity = 0.0 +6:4/0/custom_data_1 = 1.0 +7:4/next_alternative_id = 4 +7:4/0 = 0 +7:4/0/physics_layer_0/linear_velocity = Vector2(0, 0) +7:4/0/physics_layer_0/angular_velocity = 0.0 +7:4/0/custom_data_1 = 1.0 + +[resource] +tile_shape = 3 +tile_size = Vector2i(128, 128) +physics_layer_0/collision_layer = 1 +terrain_set_0/mode = 0 +terrain_set_0/terrain_0/name = "Terrain 0" +terrain_set_0/terrain_0/color = Color(1, 1, 1, 1) +custom_data_layer_0/name = "IsObstacle" +custom_data_layer_0/type = 1 +custom_data_layer_1/name = "Cost" +custom_data_layer_1/type = 3 +sources/3 = SubResource("TileSetAtlasSource_82xe3")