diff --git a/addons/enhanced_gridmap/enhanced_gridmap.gd b/addons/enhanced_gridmap/enhanced_gridmap.gd index 2d7ffbf..7325ba1 100644 --- a/addons/enhanced_gridmap/enhanced_gridmap.gd +++ b/addons/enhanced_gridmap/enhanced_gridmap.gd @@ -7,6 +7,7 @@ signal grid_updated @export var columns: int = 10 : set = set_columns @export var rows: int = 10 : set = set_rows +@export var floors: int = 3 : set = set_floors @export var auto_generate: bool = false : set = set_auto_generate @export var normal_items: Array[int] = [0] @@ -16,10 +17,10 @@ signal grid_updated @export var end_item: int = 3 var current_mesh_library: MeshLibrary -var grid_data: Array = [] +var grid_data: Array = [] # 3D array [floor][row][column] -# A* Pathfinding variables -var astar = AStar2D.new() +# A* Pathfinding variables (per floor) +var astar_by_floor = {} # Dictionary of AStar2D instances per floor var path = [] # Item states @@ -28,7 +29,6 @@ enum ItemState {NORMAL, HOVER, START, END, NON_WALKABLE} # Add this to the class variables var diagonal_movement: bool = false - func _ready(): mesh_library_changed.connect(_on_mesh_library_changed) if not Engine.is_editor_hint() and auto_generate: @@ -37,6 +37,13 @@ func _ready(): # Validate item indices validate_item_indices() +func set_floors(value: int): + floors = value + if auto_generate: + generate_grid() + else: + update_grid_data() + func validate_item_indices(): if not mesh_library: print("Warning: No MeshLibrary assigned to GridMap") @@ -75,9 +82,23 @@ func set_auto_generate(value: bool): if auto_generate: generate_grid() -# Override the existing functions to update A* data -func generate_grid(): - clear() +# Modified generate_grid to support floors +func generate_grid(floor_index: int = -1): + if floor_index == -1: + # Generate all floors + clear() + for y in range(floors): + generate_floor(y) + else: + # Generate specific floor + clear_floor(floor_index) + generate_floor(floor_index) + + update_grid_data() + initialize_astar() + update_astar_costs() + +func generate_floor(floor_index: int): if not mesh_library: print("Error: No MeshLibrary assigned to GridMap") return @@ -91,17 +112,36 @@ func generate_grid(): for x in range(columns): for z in range(rows): - set_cell_item(Vector3i(x, 0, z), normal_items[0]) + set_cell_item(Vector3i(x, floor_index, z), normal_items[0]) + +# Clear specific floor +func clear_floor(floor_index: int): + for x in range(columns): + for z in range(rows): + set_cell_item(Vector3i(x, floor_index, z), INVALID_CELL_ITEM) + update_grid_data() + +# Modified clear_grid to support floors +func clear_grid(floor_index: int = -1): + if floor_index == -1: + clear() + else: + clear_floor(floor_index) + update_grid_data() + +# Modified randomize_grid to support floors +func randomize_grid(floor_index: int = -1): + if floor_index == -1: + for y in range(floors): + randomize_floor(y) + else: + randomize_floor(floor_index) update_grid_data() initialize_astar() update_astar_costs() -func clear_grid(): - clear() - update_grid_data() - -func randomize_grid(): +func randomize_floor(floor_index: int): if not mesh_library: print("Error: No MeshLibrary assigned to GridMap") return @@ -119,16 +159,31 @@ func randomize_grid(): item_index = normal_items[rng.randi() % normal_items.size()] else: item_index = non_walkable_items[rng.randi() % non_walkable_items.size()] - set_cell_from_data(x, z, item_index) - + set_cell_item(Vector3i(x, floor_index, z), item_index) + +# Modified randomize_grid_custom to properly handle mesh library items +func randomize_grid_custom(randomize_states: Array, floor_index: int = -1): + if not mesh_library: + print("Error: No MeshLibrary assigned to GridMap") + return + + if floor_index == -1: + for y in range(floors): + randomize_floor_custom(randomize_states, y) + else: + # Randomize specific floor + if floor_index >= 0 and floor_index < floors: + randomize_floor_custom(randomize_states, floor_index) + else: + print("Invalid floor index") + update_grid_data() initialize_astar() update_astar_costs() - emit_signal("grid_updated") -func randomize_grid_custom(randomize_states: Array): - if not mesh_library: - print("Error: No MeshLibrary assigned to GridMap") +func randomize_floor_custom(randomize_states: Array, floor_index: int): + if randomize_states.is_empty(): + print("No randomize states provided") return var rng = RandomNumberGenerator.new() @@ -136,27 +191,38 @@ func randomize_grid_custom(randomize_states: Array): for x in range(columns): for z in range(rows): - var random_value = rng.randf() * 100 # Generate a random number between 0 and 100 + var cell_pos = Vector3i(x, floor_index, z) + var random_value = rng.randf() * 100 var accumulated_percentage = 0 var selected_state = null for state in randomize_states: - accumulated_percentage += state.randomize_percentage - if random_value <= accumulated_percentage: - selected_state = state - break + if state.include_in_randomize: + accumulated_percentage += state.randomize_percentage + if random_value <= accumulated_percentage: + selected_state = state + break + # Get current cell orientation + var current_orientation = get_cell_item_orientation(cell_pos) + if selected_state: - set_cell_from_data(x, z, selected_state.id) + set_cell_item(cell_pos, selected_state.id, current_orientation) else: - set_cell_from_data(x, z, randomize_states[0].id) # Default to the first state if no match + # Find first enabled state or use normal item as fallback + var fallback_state = null + for state in randomize_states: + if state.include_in_randomize: + fallback_state = state + break + + if fallback_state: + set_cell_item(cell_pos, fallback_state.id, current_orientation) + else: + set_cell_item(cell_pos, normal_items[0], current_orientation) - update_grid_data() - initialize_astar() - update_astar_costs() - emit_signal("grid_updated") - -func fill_grid(item_index: int): +# Fill grid for specific floor +func fill_grid(item_index: int, floor_index: int = -1): if not mesh_library: print("No MeshLibrary assigned to GridMap") return @@ -165,11 +231,27 @@ func fill_grid(item_index: int): print("Invalid item index") return - for x in range(columns): - for z in range(rows): - set_cell_item(Vector3i(x, 0, z), item_index) + if floor_index == -1: + for y in range(floors): + fill_floor(item_index, y) + else: + # Fill specific floor + if floor_index >= 0 and floor_index < floors: + fill_floor(item_index, floor_index) + else: + print("Invalid floor index") update_grid_data() + initialize_astar() + update_astar_costs() + +func fill_floor(item_index: int, floor_index: int): + for x in range(columns): + for z in range(rows): + var cell_pos = Vector3i(x, floor_index, z) + # Preserve the current cell's orientation when filling + var current_orientation = get_cell_item_orientation(cell_pos) + set_cell_item(cell_pos, item_index, current_orientation) func _on_mesh_library_changed(): validate_item_indices() @@ -183,92 +265,101 @@ func _set(property, value): return true return false +# Modified update_grid_data for 3D array func update_grid_data(): grid_data.clear() - for z in range(rows): - var row = [] - for x in range(columns): - row.append(get_cell_item(Vector3i(x, 0, z))) - grid_data.append(row) + for y in range(floors): + var floor_data = [] + for z in range(rows): + var row = [] + for x in range(columns): + row.append(get_cell_item(Vector3i(x, y, z))) + floor_data.append(row) + grid_data.append(floor_data) emit_signal("grid_updated") -func set_cell_from_data(x: int, z: int, item_index: int): - if x >= 0 and x < columns and z >= 0 and z < rows: - if not mesh_library: - print("Error: No MeshLibrary assigned to GridMap") - return - - var item_list = mesh_library.get_item_list() - var max_index = item_list.size() - 1 - var valid_index = clamp(item_index, 0, max_index) - - set_cell_item(Vector3i(x, 0, z), valid_index) - grid_data[z][x] = valid_index - var point_id = z * columns + x - var cost = get_cell_cost(x, z) - if cost == INF: - astar.set_point_disabled(point_id, true) - else: - astar.set_point_disabled(point_id, false) - astar.set_point_weight_scale(point_id, cost) - -# New A* Pathfinding functions -# Modify the initialize_astar function -func initialize_astar(): - astar.clear() - for x in range(columns): - for z in range(rows): - var point_id = z * columns + x - astar.add_point(point_id, Vector2(x, z)) - - # Connect to neighboring points - if x > 0: - astar.connect_points(point_id, point_id - 1) - if z > 0: - astar.connect_points(point_id, point_id - columns) - - # Add diagonal connections if diagonal movement is enabled - if diagonal_movement: - if x > 0 and z > 0: - astar.connect_points(point_id, point_id - columns - 1) # Top-left - if x < columns - 1 and z > 0: - astar.connect_points(point_id, point_id - columns + 1) # Top-right +# New function to swap items on a specific floor +func swap_items(old_item: int, new_item: int, floor_index: int = -1): + if floor_index == -1: + for y in range(floors): + swap_items_on_floor(old_item, new_item, y) + else: + swap_items_on_floor(old_item, new_item, floor_index) + update_grid_data() + initialize_astar() + update_astar_costs() + +func swap_items_on_floor(old_item: int, new_item: int, floor_index: int): + for x in range(columns): + for z in range(rows): + var cell_pos = Vector3i(x, floor_index, z) + if get_cell_item(cell_pos) == old_item: + set_cell_item(cell_pos, new_item) + +# Modified A* pathfinding for multiple floors +func initialize_astar(): + astar_by_floor.clear() + for y in range(floors): + var astar = AStar2D.new() + for x in range(columns): + for z in range(rows): + var point_id = z * columns + x + astar.add_point(point_id, Vector2(x, z)) + + if x > 0: + astar.connect_points(point_id, point_id - 1) + if z > 0: + astar.connect_points(point_id, point_id - columns) + + if diagonal_movement: + if x > 0 and z > 0: + astar.connect_points(point_id, point_id - columns - 1) # Top-left + if x < columns - 1 and z > 0: + astar.connect_points(point_id, point_id - columns + 1) # Top-right + + astar_by_floor[y] = astar update_astar_costs() -# Add this function to toggle diagonal movement func set_diagonal_movement(enable: bool): diagonal_movement = enable initialize_astar() # Reinitialize the A* graph with new connections -func set_point_solid(x: int, z: int, is_solid: bool): - var point_id = z * columns + x - astar.set_point_disabled(point_id, is_solid) +func set_point_solid(x: int, z: int, floor_index: int, is_solid: bool): + var astar = astar_by_floor.get(floor_index) + if astar: + var point_id = z * columns + x + astar.set_point_disabled(point_id, is_solid) -func find_path(start: Vector2, end: Vector2) -> Array: +# Modified path finding for specific floor +func find_path(start: Vector2, end: Vector2, floor_index: int = 0) -> Array: + var astar = astar_by_floor.get(floor_index) + if not astar: + return [] + var start_point = start.y * columns + start.x var end_point = end.y * columns + end.x path = astar.get_point_path(start_point, end_point) - # Visualize the path - clear_path_visualization() - set_cell_item(Vector3i(start.x, 0, start.y), start_item) - set_cell_item(Vector3i(end.x, 0, end.y), end_item) + clear_path_visualization(floor_index) + set_cell_item(Vector3i(start.x, floor_index, start.y), start_item) + set_cell_item(Vector3i(end.x, floor_index, end.y), end_item) for point in path: if point != start and point != end: - set_cell_item(Vector3i(point.x, 0, point.y), hover_item) + set_cell_item(Vector3i(point.x, floor_index, point.y), hover_item) return path -func clear_path_visualization(): +# Modified path visualization clearing for specific floor +func clear_path_visualization(floor_index: int = 0): for x in range(columns): for z in range(rows): - var cell_item = get_cell_item(Vector3i(x, 0, z)) + var cell_item = get_cell_item(Vector3i(x, floor_index, z)) if cell_item == hover_item or cell_item == start_item or cell_item == end_item: - set_cell_item(Vector3i(x, 0, z), normal_items[0]) + set_cell_item(Vector3i(x, floor_index, z), normal_items[0]) -func get_cell_cost(x: int, z: int) -> float: - var cell_item = get_cell_item(Vector3i(x, 0, z)) +func get_cell_cost(x: int, z: int, floor_index: int = 0) -> float: + var cell_item = get_cell_item(Vector3i(x, floor_index, z)) if cell_item in non_walkable_items: return INF elif cell_item == hover_item: @@ -277,16 +368,20 @@ func get_cell_cost(x: int, z: int) -> float: return 0.0 return 1.0 +# Modified update_astar_costs for multiple floors func update_astar_costs(): - for x in range(columns): - for z in range(rows): - var point_id = z * columns + x - var cost = get_cell_cost(x, z) - if cost == INF: - astar.set_point_disabled(point_id, true) - else: - astar.set_point_disabled(point_id, false) - astar.set_point_weight_scale(point_id, cost) + for floor_index in range(floors): + var astar = astar_by_floor.get(floor_index) + if astar: + for x in range(columns): + for z in range(rows): + var point_id = z * columns + x + var cost = get_cell_cost(x, z, floor_index) + if cost == INF: + astar.set_point_disabled(point_id, true) + else: + astar.set_point_disabled(point_id, false) + astar.set_point_weight_scale(point_id, cost) func get_cell_rotation(position: Vector3i) -> int: return get_cell_item_orientation(position) diff --git a/addons/enhanced_gridmap/enhanced_gridmap_dock.gd b/addons/enhanced_gridmap/enhanced_gridmap_dock.gd index 2bafa31..5c89657 100644 --- a/addons/enhanced_gridmap/enhanced_gridmap_dock.gd +++ b/addons/enhanced_gridmap/enhanced_gridmap_dock.gd @@ -5,9 +5,11 @@ var enhanced_gridmap: EnhancedGridMap @onready var columns_spin = $VBoxContainer/Columns/SpinBox @onready var rows_spin = $VBoxContainer/Rows/SpinBox +@onready var floor_spin = $VBoxContainer/FloorContainer/FloorSpinBox +@onready var floors_count_spin = $VBoxContainer/FloorsCount/SpinBox @onready var auto_generate_check = $VBoxContainer/AutoGenerate -@onready var generate_button = $VBoxContainer/GenerateButton -@onready var clear_button = $VBoxContainer/ClearButton +@onready var generate_button = $VBoxContainer/GridOperations/GenerateButton +@onready var clear_button = $VBoxContainer/GridOperations/ClearButton @onready var randomize_button = $VBoxContainer/RandomizeButton @onready var fill_options = $VBoxContainer/FillOptions @onready var fill_button = $VBoxContainer/FillButton @@ -28,10 +30,14 @@ var enhanced_gridmap: EnhancedGridMap @onready var start_item_spin = $VBoxContainer/ItemStates/StartItem/SpinBox @onready var end_item_spin = $VBoxContainer/ItemStates/EndItem/SpinBox @onready var non_walkable_item_spin = $VBoxContainer/ItemStates/NonWalkableItem/SpinBox -# Custom item states UI elements @onready var item_states_container = $VBoxContainer/ItemStates/ItemStatesContainer @onready var add_item_state_button = $VBoxContainer/ItemStates/AddItemStateButton +# Item Management UI elements +@onready var old_item_spin = $VBoxContainer/ItemManagement/SwapItems/OldItem +@onready var new_item_spin = $VBoxContainer/ItemManagement/SwapItems/NewItem +@onready var swap_button = $VBoxContainer/ItemManagement/SwapItems/SwapButton + var row_containers: Array = [] var cell_options: Array = [] var custom_item_states: Dictionary = {} @@ -44,6 +50,8 @@ func _ready(): func connect_signals(): columns_spin.value_changed.connect(_on_columns_changed) rows_spin.value_changed.connect(_on_rows_changed) + floor_spin.value_changed.connect(_on_floor_changed) + floors_count_spin.value_changed.connect(_on_floors_count_changed) auto_generate_check.toggled.connect(_on_auto_generate_toggled) generate_button.pressed.connect(_on_generate_pressed) clear_button.pressed.connect(_on_clear_pressed) @@ -57,13 +65,11 @@ func connect_signals(): start_item_spin.value_changed.connect(_on_start_item_changed) end_item_spin.value_changed.connect(_on_end_item_changed) non_walkable_item_spin.value_changed.connect(_on_non_walkable_item_changed) + swap_button.pressed.connect(_on_swap_items_pressed) func initialize_custom_item_states(): # Add default item states add_custom_item_state("Normal", 0) - #add_custom_item_state("Hover", 1) - #add_custom_item_state("Start", 2) - #add_custom_item_state("End", 3) add_custom_item_state("Non-Walkable", 4) func add_custom_item_state(name: String, id: int): @@ -89,7 +95,7 @@ func add_item_state_ui(item_state: CustomItemState): id_spin.value_changed.connect(_on_item_state_id_changed.bind(item_state)) randomize_check.text = "🎲" - randomize_check.button_pressed = item_state.include_in_randomize # Changed from 'pressed' to 'button_pressed' + randomize_check.button_pressed = item_state.include_in_randomize randomize_check.toggled.connect(_on_item_state_randomize_toggled.bind(item_state)) percentage_spin.min_value = 0 @@ -142,11 +148,19 @@ class CustomItemState: id = _id func set_enhanced_gridmap(gridmap: EnhancedGridMap): + # Disconnect from previous gridmap if it exists + if enhanced_gridmap: + if enhanced_gridmap.grid_updated.is_connected(_on_grid_updated): + enhanced_gridmap.grid_updated.disconnect(_on_grid_updated) + enhanced_gridmap = gridmap - enhanced_gridmap.grid_updated.connect(_on_grid_updated) - update_ui() - diagonal_movement_check.button_pressed = enhanced_gridmap.diagonal_movement - print("EnhancedGridMap set: ", enhanced_gridmap) + if enhanced_gridmap: + enhanced_gridmap.grid_updated.connect(_on_grid_updated) + floor_spin.max_value = enhanced_gridmap.floors - 1 + floors_count_spin.value = enhanced_gridmap.floors + update_ui() + diagonal_movement_check.button_pressed = enhanced_gridmap.diagonal_movement + print("EnhancedGridMap set: ", enhanced_gridmap) func update_ui(): if enhanced_gridmap: @@ -157,7 +171,6 @@ func update_ui(): _update_grid_ui() _update_astar_ui() _update_item_state_ui() - print("UI updated. Columns: ", enhanced_gridmap.columns, " Rows: ", enhanced_gridmap.rows) func _update_fill_options(): fill_options.clear() @@ -166,6 +179,8 @@ func _update_fill_options(): for i in range(item_list.size()): fill_options.add_item(enhanced_gridmap.mesh_library.get_item_name(item_list[i]), i) +# In enhanced_gridmap_dock.gd, update the _update_grid_ui function: + func _update_grid_ui(): for child in grid_container.get_children(): child.queue_free() @@ -177,9 +192,8 @@ func _update_grid_ui(): return var item_list = enhanced_gridmap.mesh_library.get_item_list() + var current_floor = floor_spin.value as int - print("Updating grid UI. Columns: ", enhanced_gridmap.columns, " Rows: ", enhanced_gridmap.rows) - for z in range(enhanced_gridmap.rows): var row_container = HBoxContainer.new() row_container.size_flags_horizontal = Control.SIZE_EXPAND_FILL @@ -192,24 +206,24 @@ func _update_grid_ui(): cell_container.size_flags_vertical = Control.SIZE_EXPAND_FILL var coord_label = Label.new() - coord_label.text = "(%d,%d)" % [x, z] + coord_label.text = "(%d,%d,%d)" % [x, current_floor, z] coord_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER coord_label.vertical_alignment = VERTICAL_ALIGNMENT_CENTER coord_label.size_flags_vertical = Control.SIZE_SHRINK_CENTER cell_container.add_child(coord_label) var option = OptionButton.new() - option.set_meta("grid_position", Vector2i(x, z)) + option.set_meta("grid_position", Vector3i(x, current_floor, z)) for i in range(item_list.size()): option.add_item(enhanced_gridmap.mesh_library.get_item_name(item_list[i]), i) - var cell_item = enhanced_gridmap.get_cell_item(Vector3i(x, 0, z)) - option.select(cell_item) + var cell_item = enhanced_gridmap.get_cell_item(Vector3i(x, current_floor, z)) + if cell_item != -1: # Changed from INVALID_CELL_ITEM to -1 + option.select(cell_item) option.item_selected.connect(_on_cell_item_selected.bind(option)) option.size_flags_horizontal = Control.SIZE_EXPAND_FILL option.size_flags_vertical = Control.SIZE_EXPAND_FILL cell_container.add_child(option) - # Add rotation Option for each cell var rotation_option = OptionButton.new() rotation_option.add_item("0°", 0) rotation_option.add_item("90°", 10) @@ -217,9 +231,8 @@ func _update_grid_ui(): rotation_option.add_item("270°", 22) rotation_option.size_flags_horizontal = Control.SIZE_EXPAND_FILL rotation_option.size_flags_vertical = Control.SIZE_SHRINK_CENTER - rotation_option.set_meta("grid_position", Vector2i(x, z)) - # Set the current item based on the cell's rotation - var current_rotation = enhanced_gridmap.get_cell_rotation(Vector3i(x, 0, z)) + rotation_option.set_meta("grid_position", Vector3i(x, current_floor, z)) + var current_rotation = enhanced_gridmap.get_cell_rotation(Vector3i(x, current_floor, z)) match current_rotation: 0: rotation_option.select(0) 10: rotation_option.select(1) @@ -228,12 +241,9 @@ func _update_grid_ui(): rotation_option.item_selected.connect(_on_cell_rotation_changed.bind(rotation_option)) cell_container.add_child(rotation_option) - row_container.add_child(cell_container) cell_options.append(option) - print("Grid UI updated. Total cells: ", cell_options.size()) - func _update_astar_ui(): start_x_spin.max_value = enhanced_gridmap.columns - 1 start_z_spin.max_value = enhanced_gridmap.rows - 1 @@ -241,21 +251,28 @@ func _update_astar_ui(): end_z_spin.max_value = enhanced_gridmap.rows - 1 func _update_item_state_ui(): - normal_item_spin.value = enhanced_gridmap.normal_item + normal_item_spin.value = enhanced_gridmap.normal_items[0] hover_item_spin.value = enhanced_gridmap.hover_item start_item_spin.value = enhanced_gridmap.start_item end_item_spin.value = enhanced_gridmap.end_item - non_walkable_item_spin.value = enhanced_gridmap.non_walkable_item + non_walkable_item_spin.value = enhanced_gridmap.non_walkable_items[0] func _on_columns_changed(value): if enhanced_gridmap: enhanced_gridmap.columns = value - print("Columns changed to: ", value) func _on_rows_changed(value): if enhanced_gridmap: enhanced_gridmap.rows = value - print("Rows changed to: ", value) + +func _on_floors_count_changed(value): + if enhanced_gridmap: + enhanced_gridmap.floors = value as int + floor_spin.max_value = value - 1 + +func _on_floor_changed(value): + if enhanced_gridmap: + _update_grid_ui() func _on_auto_generate_toggled(button_pressed): if enhanced_gridmap: @@ -263,80 +280,83 @@ func _on_auto_generate_toggled(button_pressed): func _on_generate_pressed(): if enhanced_gridmap: - enhanced_gridmap.generate_grid() - print("Generate grid pressed") + var current_floor = floor_spin.value as int + enhanced_gridmap.generate_grid(current_floor) func _on_clear_pressed(): if enhanced_gridmap: - enhanced_gridmap.clear_grid() - print("Clear grid pressed") + var current_floor = floor_spin.value as int + enhanced_gridmap.clear_grid(current_floor) func _on_randomize_pressed(): if enhanced_gridmap: + var current_floor = floor_spin.value as int var randomize_states = [] var total_percentage = 0 + + # Collect only enabled randomize states for state in custom_item_states.values(): if state.include_in_randomize: randomize_states.append(state) total_percentage += state.randomize_percentage + if randomize_states.is_empty(): + print("No states selected for randomization") + return + if total_percentage != 100: print("Warning: Total randomize percentage is not 100%") - enhanced_gridmap.randomize_grid_custom(randomize_states) + enhanced_gridmap.randomize_grid_custom(randomize_states, current_floor) func _on_fill_pressed(): if enhanced_gridmap: + var current_floor = floor_spin.value as int var selected_index = fill_options.get_selected_id() - enhanced_gridmap.fill_grid(selected_index) - print("Fill grid pressed with item index: ", selected_index) + if selected_index >= 0: + enhanced_gridmap.fill_grid(selected_index, current_floor) + else: + print("No item selected for filling") func _on_cell_item_selected(index: int, option: OptionButton): var position = option.get_meta("grid_position") if enhanced_gridmap: - enhanced_gridmap.set_cell_from_data(position.x, position.y, index) - print("Cell item selected: ", index, " at position: ", position) + enhanced_gridmap.set_cell_item(position, index) func _on_find_path_pressed(): if enhanced_gridmap: + var current_floor = floor_spin.value as int var start = Vector2(start_x_spin.value, start_z_spin.value) var end = Vector2(end_x_spin.value, end_z_spin.value) - var path = enhanced_gridmap.find_path(start, end) + var path = enhanced_gridmap.find_path(start, end, current_floor) if path.is_empty(): path_result_label.text = "No path found" else: path_result_label.text = "Path found: " + str(path) - print("Find path pressed. Start: ", start, " End: ", end) func _on_diagonal_movement_toggled(button_pressed): if enhanced_gridmap: enhanced_gridmap.set_diagonal_movement(button_pressed) - print("Diagonal movement toggled: ", button_pressed) func _on_normal_item_changed(value): if enhanced_gridmap: - enhanced_gridmap.normal_item = value - print("Normal item changed to: ", value) + enhanced_gridmap.normal_items[0] = value func _on_hover_item_changed(value): if enhanced_gridmap: enhanced_gridmap.hover_item = value - print("Hover item changed to: ", value) func _on_start_item_changed(value): if enhanced_gridmap: enhanced_gridmap.start_item = value - print("Start item changed to: ", value) func _on_end_item_changed(value): if enhanced_gridmap: enhanced_gridmap.end_item = value - print("End item changed to: ", value) func _on_non_walkable_item_changed(value): if enhanced_gridmap: - enhanced_gridmap.non_walkable_item = value - print("Non-walkable item changed to: ", value) + enhanced_gridmap.non_walkable_items[0] = value func _on_grid_updated(): update_ui() @@ -345,5 +365,10 @@ func _on_cell_rotation_changed(index: int, option: OptionButton): var position = option.get_meta("grid_position") var rotation_value = option.get_item_id(index) if enhanced_gridmap: - enhanced_gridmap.set_cell_rotation(Vector3i(position.x, 0, position.y), rotation_value) - print("Cell rotation changed: ", rotation_value, " at position: ", position) + enhanced_gridmap.set_cell_rotation(position, rotation_value) + +func _on_swap_items_pressed(): + if enhanced_gridmap: + var old_item = old_item_spin.value as int + var new_item = new_item_spin.value as int + enhanced_gridmap.swap_items(old_item, new_item, floor_spin.value as int) diff --git a/addons/enhanced_gridmap/enhanced_gridmap_dock.tscn b/addons/enhanced_gridmap/enhanced_gridmap_dock.tscn index 30eeeed..95dc45c 100644 --- a/addons/enhanced_gridmap/enhanced_gridmap_dock.tscn +++ b/addons/enhanced_gridmap/enhanced_gridmap_dock.tscn @@ -22,6 +22,17 @@ text = "☕︎ Enhanced Grid Map" [node name="HSeparator" type="HSeparator" parent="VBoxContainer"] layout_mode = 2 +[node name="FloorContainer" type="HBoxContainer" parent="VBoxContainer"] +layout_mode = 2 + +[node name="Label" type="Label" parent="VBoxContainer/FloorContainer"] +layout_mode = 2 +text = "Floor:" + +[node name="FloorSpinBox" type="SpinBox" parent="VBoxContainer/FloorContainer"] +layout_mode = 2 +max_value = 10.0 + [node name="Columns" type="HBoxContainer" parent="VBoxContainer"] layout_mode = 2 @@ -46,16 +57,33 @@ layout_mode = 2 min_value = 1.0 value = 10.0 +[node name="FloorsCount" type="HBoxContainer" parent="VBoxContainer"] +layout_mode = 2 + +[node name="Label" type="Label" parent="VBoxContainer/FloorsCount"] +layout_mode = 2 +text = "Total Floors:" + +[node name="SpinBox" type="SpinBox" parent="VBoxContainer/FloorsCount"] +layout_mode = 2 +min_value = 1.0 +value = 3.0 + [node name="AutoGenerate" type="CheckBox" parent="VBoxContainer"] layout_mode = 2 text = "Auto Generate" -[node name="ClearButton" type="Button" parent="VBoxContainer"] +[node name="GridOperations" type="HBoxContainer" parent="VBoxContainer"] layout_mode = 2 + +[node name="ClearButton" type="Button" parent="VBoxContainer/GridOperations"] +layout_mode = 2 +size_flags_horizontal = 3 text = "Clear Grid" -[node name="GenerateButton" type="Button" parent="VBoxContainer"] +[node name="GenerateButton" type="Button" parent="VBoxContainer/GridOperations"] layout_mode = 2 +size_flags_horizontal = 3 text = "Generate Grid" [node name="QuickFillLabel" type="Label" parent="VBoxContainer"] @@ -235,3 +263,32 @@ text = "Find Path" layout_mode = 2 text = "Path Result:" autowrap_mode = 2 + +[node name="ItemManagement" type="VBoxContainer" parent="VBoxContainer"] +layout_mode = 2 + +[node name="Label" type="Label" parent="VBoxContainer/ItemManagement"] +layout_mode = 2 +text = "Item Management" + +[node name="HSeparator" type="HSeparator" parent="VBoxContainer/ItemManagement"] +layout_mode = 2 + +[node name="SwapItems" type="HBoxContainer" parent="VBoxContainer/ItemManagement"] +layout_mode = 2 + +[node name="OldItem" type="SpinBox" parent="VBoxContainer/ItemManagement/SwapItems"] +layout_mode = 2 +tooltip_text = "Old Item ID" + +[node name="Label" type="Label" parent="VBoxContainer/ItemManagement/SwapItems"] +layout_mode = 2 +text = "->" + +[node name="NewItem" type="SpinBox" parent="VBoxContainer/ItemManagement/SwapItems"] +layout_mode = 2 +tooltip_text = "New Item ID" + +[node name="SwapButton" type="Button" parent="VBoxContainer/ItemManagement/SwapItems"] +layout_mode = 2 +text = "Swap Items" diff --git a/addons/enhanced_gridmap/meshlibrary/default.tres b/addons/enhanced_gridmap/meshlibrary/default.tres index 1c34963..7bbd5b6 100644 --- a/addons/enhanced_gridmap/meshlibrary/default.tres +++ b/addons/enhanced_gridmap/meshlibrary/default.tres @@ -1,10 +1,53 @@ -[gd_resource type="MeshLibrary" load_steps=7 format=3 uid="uid://54tpx8cmksfc"] +[gd_resource type="MeshLibrary" load_steps=14 format=4 uid="uid://54tpx8cmksfc"] [ext_resource type="ArrayMesh" uid="uid://dqguomxd16u0i" path="res://assets/models/meshes/start.res" id="1_xdwel"] [ext_resource type="ArrayMesh" uid="uid://dspusnbkr74hg" path="res://assets/models/meshes/hover.res" id="2_5gp4i"] [ext_resource type="Material" uid="uid://bsyh0x4cy5qyr" path="res://assets/models/meshes/end.tres" id="3_qi66w"] +[ext_resource type="Texture2D" uid="uid://dpkx1a780pvwv" path="res://assets/textures/tile_diamond.png" id="3_re0fd"] [ext_resource type="ArrayMesh" uid="uid://d4himvyb81in8" path="res://assets/models/meshes/non-walkable.res" id="4_h83ju"] [ext_resource type="ArrayMesh" uid="uid://bgvropltcot0q" path="res://assets/models/meshes/normal.res" id="5_san4u"] +[ext_resource type="ArrayMesh" uid="uid://36tgon3b60db" path="res://assets/models/tiles/tile_heart.tres" id="6_r6sve"] +[ext_resource type="ArrayMesh" uid="uid://cv4bedhida00g" path="res://assets/models/tiles/tile_star.tres" id="7_v40i1"] +[ext_resource type="ArrayMesh" uid="uid://bhlvvdtiykgnn" path="res://assets/models/meshes/tiles.res" id="8_ul3lk"] + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_2vf4e"] +resource_name = "boost" +transparency = 1 +cull_mode = 2 +albedo_color = Color(0.91, 0.91, 0.91, 0.45098) +albedo_texture = ExtResource("3_re0fd") + +[sub_resource type="ArrayMesh" id="ArrayMesh_0evu4"] +_surfaces = [{ +"aabb": AABB(-0.282176, -0.000324821, -0.282176, 0.564351, 0.050792, 0.564351), +"format": 34896613377, +"index_count": 36, +"index_data": PackedByteArray("BwAEAAUABwAGAAQABQACAAMABQAEAAIAAAAEAAYAAAACAAQABQABAAcABQADAAEAAgABAAMAAgAAAAEAAQAGAAcAAQAAAAYA"), +"name": "boost", +"primitive": 3, +"uv_scale": Vector4(0, 0, 0, 0), +"vertex_count": 8, +"vertex_data": PackedByteArray("AAD/////AAAAAP7/AAAAAP///////wAA///+/wAAAAD//wAA//8AAP//AAAAAAAAAAAAAP//AAAAAAAAAAAAAA==") +}] +blend_shape_mode = 0 + +[sub_resource type="ArrayMesh" id="ArrayMesh_pte2c"] +resource_name = "tile_diamond" +_surfaces = [{ +"aabb": AABB(-0.282176, -0.000324821, -0.282176, 0.564351, 0.050792, 0.564351), +"attribute_data": PackedByteArray("sPss5W0hot47+9DosPv6720hXCE7+6/6sPvl75Heot6r9qfksPu0+pHeXCHM5KfkSvvl78X6sfqr9kDkSvu0+sX6tuTM5EDkSvss5c7ksfrU+tDoSvv6787ktuTU+q/6"), +"format": 34896613399, +"index_count": 36, +"index_data": PackedByteArray("FgANABAAFgATAA0AEQAIAAsAEQAOAAgAAAAMABIAAAAGAAwADwADABUADwAJAAMABwAEAAoABwABAAQABQAUABcABQACABQA"), +"material": SubResource("StandardMaterial3D_2vf4e"), +"name": "tile_coin_diamond", +"primitive": 3, +"uv_scale": Vector4(0, 0, 0, 0), +"vertex_count": 24, +"vertex_data": PackedByteArray("AAD//////78AAP//////vwAA/////6oqAAD+/wAAAAAAAP7/AAD/vwAA/v8AAKoq/////////7//////////v//////////////+/wAAAAD///7/AAD/v////v8AAP////8AAP///7///wAA////P///AAD///////8AAAAAAAD//wAAAAD/P///AAAAAP//AAAAAP///78AAAAA////PwAAAAD//6oqAAAAAAAAAAAAAAAAAAD/PwAAAAAAAKoq/////////39U1VTV/7//v////39U1VTV/////////3//v/9//7//v////3//v/9//////wAA/3//v/9//7//vwAA/3//v/9//////wAA/39U1VTV/7//vwAA/39U1VTV") +}] +blend_shape_mode = 0 +shadow_mesh = SubResource("ArrayMesh_0evu4") [sub_resource type="PlaneMesh" id="PlaneMesh_ti6kf"] material = ExtResource("3_qi66w") @@ -47,8 +90,27 @@ item/6/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0) item/6/shapes = [] item/6/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0) item/6/navigation_layers = 1 -item/7/name = "tile_1" -item/7/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0) +item/7/name = "tile_heart" +item/7/mesh = ExtResource("6_r6sve") +item/7/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.9, 0) item/7/shapes = [] item/7/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0) item/7/navigation_layers = 1 +item/8/name = "tile_star" +item/8/mesh = ExtResource("7_v40i1") +item/8/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.9, 0) +item/8/shapes = [] +item/8/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0) +item/8/navigation_layers = 1 +item/9/name = "tile_coin" +item/9/mesh = ExtResource("8_ul3lk") +item/9/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.9, 0) +item/9/shapes = [] +item/9/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0) +item/9/navigation_layers = 1 +item/10/name = "tile_diamond" +item/10/mesh = SubResource("ArrayMesh_pte2c") +item/10/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.9, 0) +item/10/shapes = [] +item/10/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0) +item/10/navigation_layers = 1 diff --git a/assets/models/meshes/tile.glb b/assets/models/meshes/tile.glb index bb02b33..e4a7bb2 100644 Binary files a/assets/models/meshes/tile.glb and b/assets/models/meshes/tile.glb differ diff --git a/assets/models/meshes/tile.glb.import b/assets/models/meshes/tile.glb.import index 7469372..132a705 100644 --- a/assets/models/meshes/tile.glb.import +++ b/assets/models/meshes/tile.glb.import @@ -31,6 +31,18 @@ animation/trimming=false animation/remove_immutable_tracks=true animation/import_rest_as_RESET=false import_script/path="" -_subresources={} +_subresources={ +"meshes": { +"tile_tile_coin_002": { +"generate/lightmap_uv": 0, +"generate/lods": 0, +"generate/shadow_meshes": 0, +"lods/normal_merge_angle": 60.0, +"lods/normal_split_angle": 25.0, +"save_to_file/enabled": true, +"save_to_file/path": "res://assets/models/meshes/tiles.res" +} +} +} gltf/naming_version=1 gltf/embedded_image_handling=1 diff --git a/assets/models/meshes/tile_coin_mat.tres b/assets/models/meshes/tile_coin_mat.tres new file mode 100644 index 0000000..3ec8b69 --- /dev/null +++ b/assets/models/meshes/tile_coin_mat.tres @@ -0,0 +1,10 @@ +[gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://dkve87aabsr81"] + +[ext_resource type="Texture2D" uid="uid://dkr3oes2jk8ar" path="res://assets/textures/tile_coin.png" id="1_5v71j"] + +[resource] +resource_name = "boost" +transparency = 1 +cull_mode = 2 +albedo_color = Color(0.91, 0.91, 0.91, 0.45098) +albedo_texture = ExtResource("1_5v71j") diff --git a/assets/models/meshes/tile_heart.tres b/assets/models/meshes/tile_heart.tres new file mode 100644 index 0000000..4e274eb --- /dev/null +++ b/assets/models/meshes/tile_heart.tres @@ -0,0 +1,41 @@ +[gd_resource type="ArrayMesh" load_steps=4 format=4 uid="uid://bl3x6wsft20n"] + +[ext_resource type="Texture2D" uid="uid://cdnxwlysxnujd" path="res://assets/textures/tile_heart.png" id="1_22stv"] + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_4nip8"] +resource_name = "boost" +cull_mode = 2 +albedo_color = Color(0.906332, 0.906332, 0.906332, 1) +albedo_texture = ExtResource("1_22stv") + +[sub_resource type="ArrayMesh" id="ArrayMesh_l8rx1"] +_surfaces = [{ +"aabb": AABB(-0.403108, -0.00046403, -0.403108, 0.806216, 0.0725601, 0.806216), +"format": 34896613377, +"index_count": 36, +"index_data": PackedByteArray("BwAEAAUABwAGAAQABQACAAMABQAEAAIAAAAEAAYAAAACAAQABQABAAcABQADAAEAAgABAAMAAgAAAAEAAQAGAAcAAQAAAAYA"), +"name": "boost", +"primitive": 3, +"uv_scale": Vector4(0, 0, 0, 0), +"vertex_count": 8, +"vertex_data": PackedByteArray("AAD/////AAAAAP7/AAAAAP///////wAA///+/wAAAAD//wAA//8AAP//AAAAAAAAAAAAAP//AAAAAAAAAAAAAA==") +}] +blend_shape_mode = 0 + +[resource] +resource_name = "tile_tile_coin_002" +_surfaces = [{ +"aabb": AABB(-0.403108, -0.00046403, -0.403108, 0.806216, 0.0725601, 0.806216), +"attribute_data": PackedByteArray("sPss5W0hot47+9DosPv6720hXCE7+6/6sPvl75Heot6r9qfksPu0+pHeXCHM5KfkSvvl78X6sfqr9kDkSvu0+sX6tuTM5EDkSvss5c7ksfrU+tDoSvv6787ktuTU+q/6"), +"format": 34896613399, +"index_count": 36, +"index_data": PackedByteArray("FgANABAAFgATAA0AEQAIAAsAEQAOAAgAAAAMABIAAAAGAAwADwADABUADwAJAAMABwAEAAoABwABAAQABQAUABcABQACABQA"), +"material": SubResource("StandardMaterial3D_4nip8"), +"name": "tile_heart", +"primitive": 3, +"uv_scale": Vector4(0, 0, 0, 0), +"vertex_count": 24, +"vertex_data": PackedByteArray("AAD//////78AAP//////vwAA/////6oqAAD+/wAAAAAAAP7/AAD/vwAA/v8AAKoq/////////7//////////v//////////////+/wAAAAD///7/AAD/v////v8AAP////8AAP///7///wAA////P///AAD///////8AAAAAAAD//wAAAAD/P///AAAAAP//AAAAAP///78AAAAA////PwAAAAD//6oqAAAAAAAAAAAAAAAAAAD/PwAAAAAAAKoq/////////39U1VTV/7//v////39U1VTV/////////3//v/9//7//v////3//v/9//////wAA/3//v/9//7//vwAA/3//v/9//////wAA/39U1VTV/7//vwAA/39U1VTV") +}] +blend_shape_mode = 0 +shadow_mesh = SubResource("ArrayMesh_l8rx1") diff --git a/assets/models/meshes/tile_heart_mat.tres b/assets/models/meshes/tile_heart_mat.tres new file mode 100644 index 0000000..16f4dca --- /dev/null +++ b/assets/models/meshes/tile_heart_mat.tres @@ -0,0 +1,10 @@ +[gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://47fnj6ims3ro"] + +[ext_resource type="Texture2D" uid="uid://cdnxwlysxnujd" path="res://assets/textures/tile_heart.png" id="1_mmk6n"] + +[resource] +resource_name = "boost" +transparency = 1 +cull_mode = 2 +albedo_color = Color(0.91, 0.91, 0.91, 0.45098) +albedo_texture = ExtResource("1_mmk6n") diff --git a/assets/models/meshes/tile_star_mat.tres b/assets/models/meshes/tile_star_mat.tres new file mode 100644 index 0000000..ff6cc68 --- /dev/null +++ b/assets/models/meshes/tile_star_mat.tres @@ -0,0 +1,10 @@ +[gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://r3o6mc6xbon"] + +[ext_resource type="Texture2D" uid="uid://ho2ba1pl835k" path="res://assets/textures/tile_star.png" id="1_l62is"] + +[resource] +resource_name = "boost" +transparency = 1 +cull_mode = 2 +albedo_color = Color(0.91, 0.91, 0.91, 0.45098) +albedo_texture = ExtResource("1_l62is") diff --git a/assets/models/meshes/tiles.res b/assets/models/meshes/tiles.res new file mode 100644 index 0000000..087ddc9 Binary files /dev/null and b/assets/models/meshes/tiles.res differ diff --git a/assets/models/tiles/tile_heart.tres b/assets/models/tiles/tile_heart.tres new file mode 100644 index 0000000..3924565 --- /dev/null +++ b/assets/models/tiles/tile_heart.tres @@ -0,0 +1,43 @@ +[gd_resource type="ArrayMesh" load_steps=4 format=4 uid="uid://36tgon3b60db"] + +[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_5d0gc"] +load_path = "res://.godot/imported/tile_heart.png-deeef50755ca225f028608dfd16900e6.s3tc.ctex" + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_uxput"] +resource_name = "boost" +transparency = 1 +cull_mode = 2 +albedo_color = Color(0.91, 0.91, 0.91, 0.45098) +albedo_texture = SubResource("CompressedTexture2D_5d0gc") + +[sub_resource type="ArrayMesh" id="ArrayMesh_acoqc"] +_surfaces = [{ +"aabb": AABB(-0.282176, -0.000324821, -0.282176, 0.564351, 0.050792, 0.564351), +"format": 34896613377, +"index_count": 36, +"index_data": PackedByteArray("BwAEAAUABwAGAAQABQACAAMABQAEAAIAAAAEAAYAAAACAAQABQABAAcABQADAAEAAgABAAMAAgAAAAEAAQAGAAcAAQAAAAYA"), +"name": "boost", +"primitive": 3, +"uv_scale": Vector4(0, 0, 0, 0), +"vertex_count": 8, +"vertex_data": PackedByteArray("AAD/////AAAAAP7/AAAAAP///////wAA///+/wAAAAD//wAA//8AAP//AAAAAAAAAAAAAP//AAAAAAAAAAAAAA==") +}] +blend_shape_mode = 0 + +[resource] +resource_name = "tile_heart" +_surfaces = [{ +"aabb": AABB(-0.282176, -0.000324821, -0.282176, 0.564351, 0.050792, 0.564351), +"attribute_data": PackedByteArray("sPss5W0hot47+9DosPv6720hXCE7+6/6sPvl75Heot6r9qfksPu0+pHeXCHM5KfkSvvl78X6sfqr9kDkSvu0+sX6tuTM5EDkSvss5c7ksfrU+tDoSvv6787ktuTU+q/6"), +"format": 34896613399, +"index_count": 36, +"index_data": PackedByteArray("FgANABAAFgATAA0AEQAIAAsAEQAOAAgAAAAMABIAAAAGAAwADwADABUADwAJAAMABwAEAAoABwABAAQABQAUABcABQACABQA"), +"material": SubResource("StandardMaterial3D_uxput"), +"name": "tile_heart_mat", +"primitive": 3, +"uv_scale": Vector4(0, 0, 0, 0), +"vertex_count": 24, +"vertex_data": PackedByteArray("AAD//////78AAP//////vwAA/////6oqAAD+/wAAAAAAAP7/AAD/vwAA/v8AAKoq/////////7//////////v//////////////+/wAAAAD///7/AAD/v////v8AAP////8AAP///7///wAA////P///AAD///////8AAAAAAAD//wAAAAD/P///AAAAAP//AAAAAP///78AAAAA////PwAAAAD//6oqAAAAAAAAAAAAAAAAAAD/PwAAAAAAAKoq/////////39U1VTV/7//v////39U1VTV/////////3//v/9//7//v////3//v/9//////wAA/3//v/9//7//vwAA/3//v/9//////wAA/39U1VTV/7//vwAA/39U1VTV") +}] +blend_shape_mode = 0 +shadow_mesh = SubResource("ArrayMesh_acoqc") diff --git a/assets/models/tiles/tile_star.tres b/assets/models/tiles/tile_star.tres new file mode 100644 index 0000000..a0505f1 --- /dev/null +++ b/assets/models/tiles/tile_star.tres @@ -0,0 +1,43 @@ +[gd_resource type="ArrayMesh" load_steps=4 format=4 uid="uid://cv4bedhida00g"] + +[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_3rnsi"] +load_path = "res://.godot/imported/tile_star.png-a6668e97668152283af0c5d51d859399.s3tc.ctex" + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_7evl5"] +resource_name = "boost" +transparency = 1 +cull_mode = 2 +albedo_color = Color(0.91, 0.91, 0.91, 0.45098) +albedo_texture = SubResource("CompressedTexture2D_3rnsi") + +[sub_resource type="ArrayMesh" id="ArrayMesh_acoqc"] +_surfaces = [{ +"aabb": AABB(-0.282176, -0.000324821, -0.282176, 0.564351, 0.050792, 0.564351), +"format": 34896613377, +"index_count": 36, +"index_data": PackedByteArray("BwAEAAUABwAGAAQABQACAAMABQAEAAIAAAAEAAYAAAACAAQABQABAAcABQADAAEAAgABAAMAAgAAAAEAAQAGAAcAAQAAAAYA"), +"name": "boost", +"primitive": 3, +"uv_scale": Vector4(0, 0, 0, 0), +"vertex_count": 8, +"vertex_data": PackedByteArray("AAD/////AAAAAP7/AAAAAP///////wAA///+/wAAAAD//wAA//8AAP//AAAAAAAAAAAAAP//AAAAAAAAAAAAAA==") +}] +blend_shape_mode = 0 + +[resource] +resource_name = "tile_star" +_surfaces = [{ +"aabb": AABB(-0.282176, -0.000324821, -0.282176, 0.564351, 0.050792, 0.564351), +"attribute_data": PackedByteArray("sPss5W0hot47+9DosPv6720hXCE7+6/6sPvl75Heot6r9qfksPu0+pHeXCHM5KfkSvvl78X6sfqr9kDkSvu0+sX6tuTM5EDkSvss5c7ksfrU+tDoSvv6787ktuTU+q/6"), +"format": 34896613399, +"index_count": 36, +"index_data": PackedByteArray("FgANABAAFgATAA0AEQAIAAsAEQAOAAgAAAAMABIAAAAGAAwADwADABUADwAJAAMABwAEAAoABwABAAQABQAUABcABQACABQA"), +"material": SubResource("StandardMaterial3D_7evl5"), +"name": "tile_star_mat", +"primitive": 3, +"uv_scale": Vector4(0, 0, 0, 0), +"vertex_count": 24, +"vertex_data": PackedByteArray("AAD//////78AAP//////vwAA/////6oqAAD+/wAAAAAAAP7/AAD/vwAA/v8AAKoq/////////7//////////v//////////////+/wAAAAD///7/AAD/v////v8AAP////8AAP///7///wAA////P///AAD///////8AAAAAAAD//wAAAAD/P///AAAAAP//AAAAAP///78AAAAA////PwAAAAD//6oqAAAAAAAAAAAAAAAAAAD/PwAAAAAAAKoq/////////39U1VTV/7//v////39U1VTV/////////3//v/9//7//v////3//v/9//////wAA/3//v/9//7//vwAA/3//v/9//////wAA/39U1VTV/7//vwAA/39U1VTV") +}] +blend_shape_mode = 0 +shadow_mesh = SubResource("ArrayMesh_acoqc") diff --git a/assets/textures/tile_coin.png b/assets/textures/tile_coin.png new file mode 100644 index 0000000..63cb490 Binary files /dev/null and b/assets/textures/tile_coin.png differ diff --git a/assets/textures/tile_coin.png.import b/assets/textures/tile_coin.png.import new file mode 100644 index 0000000..6cf3b4a --- /dev/null +++ b/assets/textures/tile_coin.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dkr3oes2jk8ar" +path.s3tc="res://.godot/imported/tile_coin.png-07bdc9862d055beeb72a967a0094a5c7.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://assets/textures/tile_coin.png" +dest_files=["res://.godot/imported/tile_coin.png-07bdc9862d055beeb72a967a0094a5c7.s3tc.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +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=0 diff --git a/assets/textures/tile_coin_holo.png b/assets/textures/tile_coin_holo.png new file mode 100644 index 0000000..52c3127 Binary files /dev/null and b/assets/textures/tile_coin_holo.png differ diff --git a/assets/textures/tile_coin_holo.png.import b/assets/textures/tile_coin_holo.png.import new file mode 100644 index 0000000..198a923 --- /dev/null +++ b/assets/textures/tile_coin_holo.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b7aipdrvxp6qw" +path="res://.godot/imported/tile_coin_holo.png-6a443a1d36bcd3bf79f0210c252c3d26.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/textures/tile_coin_holo.png" +dest_files=["res://.godot/imported/tile_coin_holo.png-6a443a1d36bcd3bf79f0210c252c3d26.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/assets/textures/tile_diamond.png b/assets/textures/tile_diamond.png new file mode 100644 index 0000000..5986eaa Binary files /dev/null and b/assets/textures/tile_diamond.png differ diff --git a/assets/textures/tile_diamond.png.import b/assets/textures/tile_diamond.png.import new file mode 100644 index 0000000..e69796d --- /dev/null +++ b/assets/textures/tile_diamond.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dpkx1a780pvwv" +path.s3tc="res://.godot/imported/tile_diamond.png-dcc41e91b1a4ca15d0db8287ce80f30b.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://assets/textures/tile_diamond.png" +dest_files=["res://.godot/imported/tile_diamond.png-dcc41e91b1a4ca15d0db8287ce80f30b.s3tc.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +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=0 diff --git a/assets/textures/tile_diamond_holo.png b/assets/textures/tile_diamond_holo.png new file mode 100644 index 0000000..023add2 Binary files /dev/null and b/assets/textures/tile_diamond_holo.png differ diff --git a/assets/textures/tile_diamond_holo.png.import b/assets/textures/tile_diamond_holo.png.import new file mode 100644 index 0000000..4cd62aa --- /dev/null +++ b/assets/textures/tile_diamond_holo.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://d3lxvx3270eun" +path="res://.godot/imported/tile_diamond_holo.png-e0c28a726d94831c5180dcc0376d012c.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/textures/tile_diamond_holo.png" +dest_files=["res://.godot/imported/tile_diamond_holo.png-e0c28a726d94831c5180dcc0376d012c.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/assets/textures/tile_heart.png b/assets/textures/tile_heart.png new file mode 100644 index 0000000..d11dc05 Binary files /dev/null and b/assets/textures/tile_heart.png differ diff --git a/assets/textures/tile_heart.png.import b/assets/textures/tile_heart.png.import new file mode 100644 index 0000000..6c48d89 --- /dev/null +++ b/assets/textures/tile_heart.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cdnxwlysxnujd" +path.s3tc="res://.godot/imported/tile_heart.png-deeef50755ca225f028608dfd16900e6.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://assets/textures/tile_heart.png" +dest_files=["res://.godot/imported/tile_heart.png-deeef50755ca225f028608dfd16900e6.s3tc.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +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=0 diff --git a/assets/textures/tile_heart_holo.png b/assets/textures/tile_heart_holo.png new file mode 100644 index 0000000..7ead484 Binary files /dev/null and b/assets/textures/tile_heart_holo.png differ diff --git a/assets/textures/tile_heart_holo.png.import b/assets/textures/tile_heart_holo.png.import new file mode 100644 index 0000000..5c149de --- /dev/null +++ b/assets/textures/tile_heart_holo.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ddbky41cba5rq" +path="res://.godot/imported/tile_heart_holo.png-5c92e04305de5aaa054336f0ec160274.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/textures/tile_heart_holo.png" +dest_files=["res://.godot/imported/tile_heart_holo.png-5c92e04305de5aaa054336f0ec160274.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/assets/textures/tile_star.png b/assets/textures/tile_star.png new file mode 100644 index 0000000..5664443 Binary files /dev/null and b/assets/textures/tile_star.png differ diff --git a/assets/textures/tile_star.png.import b/assets/textures/tile_star.png.import new file mode 100644 index 0000000..130d69a --- /dev/null +++ b/assets/textures/tile_star.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ho2ba1pl835k" +path.s3tc="res://.godot/imported/tile_star.png-a6668e97668152283af0c5d51d859399.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://assets/textures/tile_star.png" +dest_files=["res://.godot/imported/tile_star.png-a6668e97668152283af0c5d51d859399.s3tc.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +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=0 diff --git a/assets/textures/tile_star_holo.png b/assets/textures/tile_star_holo.png new file mode 100644 index 0000000..cca113a Binary files /dev/null and b/assets/textures/tile_star_holo.png differ diff --git a/assets/textures/tile_star_holo.png.import b/assets/textures/tile_star_holo.png.import new file mode 100644 index 0000000..6323948 --- /dev/null +++ b/assets/textures/tile_star_holo.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dqpr1nug528ml" +path="res://.godot/imported/tile_star_holo.png-4aade3ef0db71672f9bd2143ab924c6e.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/textures/tile_star_holo.png" +dest_files=["res://.godot/imported/tile_star_holo.png-4aade3ef0db71672f9bd2143ab924c6e.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/scenes/main.tscn b/scenes/main.tscn index 995d969..5ad50c7 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -13,14 +13,15 @@ turn_based_mode = false mesh_library = ExtResource("1_110wo") cell_size = Vector3(1, 1, 1) data = { -"cells": PackedInt32Array(0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 3, 0, 0, 4, 0, 0, 5, 0, 0, 6, 0, 0, 7, 0, 0, 8, 0, 0, 9, 0, 1, 0, 0, 1, 1, 0, 1, 2, 0, 1, 3, 0, 1, 4, 0, 1, 5, 0, 1, 6, 0, 1, 7, 0, 1, 8, 0, 1, 9, 0, 2, 0, 0, 2, 1, 0, 2, 2, 0, 2, 3, 0, 2, 4, 0, 2, 5, 0, 2, 6, 0, 2, 7, 0, 2, 8, 0, 2, 9, 0, 3, 0, 0, 3, 1, 0, 3, 2, 0, 3, 3, 0, 3, 4, 0, 3, 5, 0, 3, 6, 0, 3, 7, 0, 3, 8, 0, 3, 9, 0, 4, 0, 0, 4, 1, 0, 4, 2, 0, 4, 3, 0, 4, 4, 0, 4, 5, 0, 4, 6, 0, 4, 7, 0, 4, 8, 0, 4, 9, 0, 5, 0, 0, 5, 1, 0, 5, 2, 0, 5, 3, 0, 5, 4, 0, 5, 5, 0, 5, 6, 0, 5, 7, 0, 5, 8, 0, 5, 9, 0, 6, 0, 0, 6, 1, 0, 6, 2, 0, 6, 3, 0, 6, 4, 0, 6, 5, 0, 6, 6, 0, 6, 7, 0, 6, 8, 0, 6, 9, 0, 7, 0, 0, 7, 1, 0, 7, 2, 0, 7, 3, 0, 7, 4, 0, 7, 5, 0, 7, 6, 0, 7, 7, 0, 7, 8, 0, 7, 9, 0, 8, 0, 0, 8, 1, 0, 8, 2, 0, 8, 3, 0, 8, 4, 0, 8, 5, 0, 8, 6, 0, 8, 7, 0, 8, 8, 0, 8, 9, 0, 9, 0, 0, 9, 1, 0, 9, 2, 0, 9, 3, 0, 9, 4, 0, 9, 5, 0, 9, 6, 0, 9, 7, 0, 9, 8, 0, 9, 9, 0) +"cells": PackedInt32Array(9, 0, 0, 9, 1, 0, 9, 2, 0, 9, 3, 0, 9, 4, 0, 9, 5, 0, 9, 8, 0, 9, 9, 0, 9, 7, 0, 9, 6, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 3, 0, 0, 4, 0, 0, 5, 0, 0, 6, 0, 0, 7, 0, 0, 8, 0, 0, 9, 0, 1, 0, 0, 1, 1, 0, 1, 2, 0, 1, 3, 0, 1, 4, 0, 1, 5, 0, 1, 6, 0, 1, 7, 0, 1, 8, 0, 1, 9, 0, 2, 0, 0, 2, 1, 0, 2, 2, 0, 2, 3, 0, 2, 4, 0, 2, 5, 0, 2, 6, 0, 2, 7, 0, 2, 8, 0, 2, 9, 0, 3, 0, 0, 3, 1, 0, 3, 2, 0, 3, 3, 0, 3, 4, 0, 3, 5, 0, 3, 6, 0, 3, 7, 0, 3, 8, 0, 3, 9, 0, 4, 0, 0, 4, 1, 0, 4, 2, 0, 4, 3, 0, 4, 4, 0, 4, 5, 0, 4, 6, 0, 4, 7, 0, 4, 8, 0, 4, 9, 0, 5, 0, 0, 5, 1, 0, 5, 2, 0, 5, 3, 0, 5, 4, 0, 5, 5, 0, 5, 6, 0, 5, 7, 0, 5, 8, 0, 5, 9, 0, 6, 0, 0, 6, 1, 0, 6, 2, 0, 6, 3, 0, 6, 4, 0, 6, 5, 0, 6, 6, 0, 6, 7, 0, 6, 8, 0, 6, 9, 0, 7, 0, 0, 7, 1, 0, 7, 2, 0, 7, 3, 0, 7, 4, 0, 7, 5, 0, 7, 6, 0, 7, 7, 0, 7, 8, 0, 7, 9, 0, 8, 0, 0, 8, 1, 0, 8, 2, 0, 8, 3, 0, 8, 4, 0, 8, 5, 0, 8, 6, 0, 8, 7, 0, 8, 8, 0, 8, 9, 0, 65536, 0, 7, 65536, 1, 7, 65536, 2, 7, 65536, 3, 7, 65536, 4, 8, 65536, 5, 7, 65536, 6, 7, 65536, 7, 7, 65536, 8, 7, 65536, 9, 7, 65537, 0, 7, 65537, 1, 7, 65537, 2, 8, 65537, 3, 8, 65537, 4, 7, 65537, 5, 7, 65537, 6, 7, 65537, 7, 8, 65537, 8, 8, 65537, 9, 7, 65538, 0, 8, 65538, 1, 7, 65538, 2, 8, 65538, 3, 8, 65538, 4, 9, 65538, 5, 7, 65538, 6, 8, 65538, 7, 7, 65538, 8, 9, 65538, 9, 8, 65539, 0, 9, 65539, 1, 7, 65539, 2, 7, 65539, 3, 7, 65539, 4, 8, 65539, 5, 7, 65539, 6, 9, 65539, 7, 7, 65539, 8, 9, 65539, 9, 9, 65540, 0, 7, 65540, 1, 9, 65540, 2, 8, 65540, 3, 7, 65540, 4, 7, 65540, 5, 7, 65540, 6, 7, 65540, 7, 8, 65540, 8, 9, 65540, 9, 7, 65541, 0, 8, 65541, 1, 9, 65541, 2, 8, 65541, 3, 7, 65541, 4, 7, 65541, 5, 9, 65541, 6, 8, 65541, 7, 7, 65541, 8, 9, 65541, 9, 7, 65542, 0, 7, 65542, 1, 7, 65542, 2, 7, 65542, 3, 9, 65542, 4, 8, 65542, 5, 8, 65542, 6, 7, 65542, 7, 8, 65542, 8, 7, 65542, 9, 7, 65543, 0, 8, 65543, 1, 9, 65543, 2, 7, 65543, 3, 9, 65543, 4, 7, 65543, 5, 7, 65543, 6, 7, 65543, 7, 8, 65543, 8, 7, 65543, 9, 8, 65544, 0, 8, 65544, 1, 7, 65544, 2, 9, 65544, 3, 8, 65544, 4, 7, 65544, 5, 9, 65544, 6, 9, 65544, 7, 9, 65544, 8, 7, 65544, 9, 9, 65545, 0, 8, 65545, 1, 8, 65545, 2, 8, 65545, 3, 8, 65545, 4, 9, 65545, 5, 7, 65545, 6, 8, 65545, 7, 8, 65545, 8, 7, 65545, 9, 7) } script = ExtResource("2_hbe1v") +floors = 2 non_walkable_items = Array[int]([4, 5]) -metadata/_editor_floor_ = Vector3(0, 0, 0) +metadata/_editor_floor_ = Vector3(0, 1, 0) [node name="Camera3D" type="Camera3D" parent="."] -transform = Transform3D(-1, -7.92319e-08, 3.69465e-08, 0, 0.422618, 0.906308, -8.74228e-08, 0.906308, -0.422618, 5, 15, -2.5) +transform = Transform3D(1, 0, 0, 0, 0.422618, 0.906308, 0, -0.906308, 0.422618, 5, 15, 12.36) environment = ExtResource("4_ky38j") fov = 35.5