diff --git a/BuildMenu.gd b/BuildMenu.gd index 1cf6224..1952388 100644 --- a/BuildMenu.gd +++ b/BuildMenu.gd @@ -11,7 +11,10 @@ const default_insects = { preload("res://Tile/Prefabs/Ant.tres"): 3, preload("res://Tile/Prefabs/Beetle.tres"): 2, preload("res://Tile/Prefabs/Grasshopper.tres"): 3, - preload("res://Tile/Prefabs/Spider.tres"): 2 + preload("res://Tile/Prefabs/Spider.tres"): 2, + preload("res://Tile/Prefabs/Ladybug.tres"): 1, + preload("res://Tile/Prefabs/Mosquito.tres"): 1, + preload("res://Tile/Prefabs/Pillbug.tres"): 1 } # Called when the node enters the scene tree for the first time. diff --git a/HexGrid3D/HexGrid3D.gd b/HexGrid3D/HexGrid3D.gd index 0d792c3..264bd7d 100644 --- a/HexGrid3D/HexGrid3D.gd +++ b/HexGrid3D/HexGrid3D.gd @@ -26,26 +26,7 @@ var used_cells: Dictionary = {} @export var layer_height: float = 0.4 -# have all used_cells be saved as Vector4i (q, r, s, y) - -class TileStorage: - var tiles: Dictionary = {} - # we use a vector4i for coordinates - # q r s y (layer) - - func add_tile(tile: InsectTile, coords: Vector4i) -> void: - tiles[coords] = tile - pass - - func remove_tile(coords: Vector4i) -> void: - pass - - func has_tile(coords: Vector4i) -> bool: - return tiles.has(coords) - - func get_tile(coords: Vector4i) -> InsectTile: - return tiles[coords] - +# have all used_cells be saved as Vector4i (q, r, s, y) class AxialCoordinates: var q: float @@ -132,27 +113,31 @@ func is_cell_not_empty(coords: Vector4i) -> bool: func get_empty_neighbours(coords: Vector4i) -> Array[Vector4i]: return get_neighbours(coords).filter(is_cell_empty) -func get_neighbours(coords: Vector4i) -> Array[Vector4i]: +func get_neighbours(coords: Vector4i, ground_layer: bool = false) -> Array[Vector4i]: + var layer: int = coords.w + if ground_layer: + layer = 0 + return [ - Vector4i(coords.x + 1, coords.y, coords.z - 1, coords.w), - Vector4i(coords.x + 1, coords.y - 1, coords.z, coords.w), - Vector4i(coords.x, coords.y - 1, coords.z + 1, coords.w), - Vector4i(coords.x - 1, coords.y, coords.z + 1, coords.w), - Vector4i(coords.x - 1, coords.y + 1, coords.z, coords.w), - Vector4i(coords.x, coords.y + 1, coords.z - 1, coords.w) + Vector4i(coords.x + 1, coords.y, coords.z - 1, layer), + Vector4i(coords.x + 1, coords.y - 1, coords.z, layer), + Vector4i(coords.x, coords.y - 1, coords.z + 1, layer), + Vector4i(coords.x - 1, coords.y, coords.z + 1, layer), + Vector4i(coords.x - 1, coords.y + 1, coords.z, layer), + Vector4i(coords.x, coords.y + 1, coords.z - 1, layer) ] var current_tile: Node3D const HEX_OUTLINE = preload("res://hex_outline.tscn") -func get_placeable_positions(button: InsectButton) -> Array: +func get_placeable_positions(button: InsectButton) -> Array[Vector4i]: if used_cells.size() == 0: return [Vector4i.ZERO] elif used_cells.size() == 1: var single_cell = used_cells.keys().front() var neighbours = get_neighbours(single_cell) - var positions = [] + var positions: Array[Vector4i] = [] for neighbour in neighbours: #var hex_pos = cube_to_world_pos(neighbour) @@ -160,7 +145,7 @@ func get_placeable_positions(button: InsectButton) -> Array: return positions var possible_placements: Dictionary = {} - var positions = [] + var positions: Array[Vector4i] = [] for hex in used_cells.keys(): for neighbour in get_empty_neighbours(hex): @@ -190,7 +175,7 @@ func get_left_neighbour(pos: Vector4i) -> Vector4i: func get_right_neighbour(pos: Vector4i) -> Vector4i: return Vector4i(-pos.y, -pos.z, -pos.x, 0) -func can_reach(start: Vector4i, target: Vector4i) -> bool: +func can_reach(start: Vector4i, target: Vector4i) -> bool: # if we have 5 potential spaces it can never be blocked var offset: Vector4i = Vector4i.ZERO @@ -201,14 +186,14 @@ func can_reach(start: Vector4i, target: Vector4i) -> bool: var left = get_left_neighbour(offset) var right = get_right_neighbour(offset) - var left_coord = Vector4i(left.x + start.x, left.y + start.y, left.z + start.z, 0) - var right_coord = Vector4i(right.x + start.x, right.y + start.y, right.z + start.z, 0) + var left_coord = Vector4i(left.x + start.x, left.y + start.y, left.z + start.z, start.w) + var right_coord = Vector4i(right.x + start.x, right.y + start.y, right.z + start.z, start.w) return is_cell_empty(left_coord) or is_cell_empty(right_coord) func _on_insect_selected(button: InsectButton, is_black: bool) -> void: var positions = get_placeable_positions(button) - for p in positions: + for p in positions: var outline = HEX_OUTLINE.instantiate() var hex_pos = cube_to_world_pos(p) outline.position = Vector3(hex_pos.x, 0.0, hex_pos.y) @@ -320,19 +305,19 @@ func _on_insect_placed(resource: TileResource, is_black: bool, pos: Vector4i) -> func can_move(tile: InsectTile) -> bool: return can_hive_exist_without_tile(tile) -func create_move_positions() -> void: - pass - func _on_insect_tile_selected(tile: InsectTile) -> void: if not can_hive_exist_without_tile(tile): + print("Would break hive") return if tile.resource.movement_behaviour == null: + print("no movement behaviour") return var spaces = tile.resource.movement_behaviour.get_available_spaces(tile.coordinates, self) if spaces.is_empty(): + print("empty?") #GameEvents.insect_tile_selection_request_failed.emit(tile) return @@ -341,13 +326,29 @@ func _on_insect_tile_selected(tile: InsectTile) -> void: var non_empty_neighbours = neighbours.filter(is_cell_not_empty) if non_empty_neighbours.size() == 1: + # NOTE: This is correct! But seemed wrong when testing the beetle movement + # If there are only two tiles (beetle + some other) the beetle can't climb ontop of the other + # tile. This fixes itself automatically when there are more than two tiles present + # And since you can't move unless you place the bee, there will always be at least 3 tiles + # before you can move your beetle var occupied_neighbour = non_empty_neighbours.front() if occupied_neighbour == tile.coordinates: continue + + var layer: int = 0 + var temp_tile: InsectTile = null + if is_cell_not_empty(space): + temp_tile = used_cells.get(space) + layer = 1 + while tile.hat != null: + layer += 1 + tile = tile.hat + + space.w = layer var outline = HEX_OUTLINE.instantiate() var hex_pos = cube_to_world_pos(space) # flat_hex_to_world_position(AxialCoordinates.new(space.x, space.y)) - outline.position = Vector3(hex_pos.x, 0.0, hex_pos.y) + outline.position = Vector3(hex_pos.x, layer * layer_height, hex_pos.y) outline.coordinates = space outline.visible = true outline.insect_tile = tile @@ -357,13 +358,15 @@ func _on_insect_tile_selected(tile: InsectTile) -> void: placement_visualizer.add_child(outline) placements[space] = outline +func get_tile(pos: Vector4i) -> InsectTile: + return used_cells.get(pos) func _on_insect_tile_moved(tile: InsectTile, target: Vector4i) -> void: used_cells.erase(tile.coordinates) var new_hex_pos = cube_to_world_pos(target) var sky_new_hex_pos = Vector3(new_hex_pos.x, 20.0, new_hex_pos.y) - var ground_new_hex_pos = Vector3(new_hex_pos.x, 0.0, new_hex_pos.y) + var ground_new_hex_pos = Vector3(new_hex_pos.x, target.w * layer_height, new_hex_pos.y) # var current_hex_pos = tile.position var sky_current_hex_pos = tile.position + Vector3(0.0, 20.0, 0.0) @@ -392,7 +395,7 @@ func get_same_neighbours(cell1: Vector4i, cell2: Vector4i) -> Array[Vector4i]: return shared_neighbours func is_position_on_hive(pos: Vector4i) -> bool: - return get_empty_neighbours(pos).size() > 0 + return get_empty_neighbours(pos).size() < 6 func can_hive_exist_without_tile(tile: InsectTile) -> bool: # TODO: BFS-Search from random cell to see if all other cells could still be reached when this @@ -402,7 +405,7 @@ func can_hive_exist_without_tile(tile: InsectTile) -> bool: # DO BFS var tiles_reached: Array = [] - var tiles_available: Array = used_cells.keys().filter(func(coords): return coords != tile.coordinates) + var tiles_available: Array = used_cells.keys().filter(func(coords): return coords != tile.coordinates).filter(func(coords): coords.w != tile.coordinates.w) if tiles_available.size() <= 1: # If we only have 1 or 2 total tiles, we can always move diff --git a/InsectTiles/Assets/Textures/ant_black.png b/InsectTiles/Assets/Textures/ant_black.png index d8c2916..d62408c 100644 Binary files a/InsectTiles/Assets/Textures/ant_black.png and b/InsectTiles/Assets/Textures/ant_black.png differ diff --git a/InsectTiles/Assets/Textures/ant_white.png b/InsectTiles/Assets/Textures/ant_white.png index 43c1dcb..2077ac2 100644 Binary files a/InsectTiles/Assets/Textures/ant_white.png and b/InsectTiles/Assets/Textures/ant_white.png differ diff --git a/InsectTiles/Assets/Textures/bee_black.png b/InsectTiles/Assets/Textures/bee_black.png index 86c51da..2bdd146 100644 Binary files a/InsectTiles/Assets/Textures/bee_black.png and b/InsectTiles/Assets/Textures/bee_black.png differ diff --git a/InsectTiles/Assets/Textures/bee_white.png b/InsectTiles/Assets/Textures/bee_white.png index cc431a4..93bebe7 100644 Binary files a/InsectTiles/Assets/Textures/bee_white.png and b/InsectTiles/Assets/Textures/bee_white.png differ diff --git a/InsectTiles/Assets/Textures/beetle_black.png b/InsectTiles/Assets/Textures/beetle_black.png index 7b38196..9e46de1 100644 Binary files a/InsectTiles/Assets/Textures/beetle_black.png and b/InsectTiles/Assets/Textures/beetle_black.png differ diff --git a/InsectTiles/Assets/Textures/beetle_white.png b/InsectTiles/Assets/Textures/beetle_white.png index 126f9f2..b36f54c 100644 Binary files a/InsectTiles/Assets/Textures/beetle_white.png and b/InsectTiles/Assets/Textures/beetle_white.png differ diff --git a/InsectTiles/Assets/Textures/grasshopper_black.png b/InsectTiles/Assets/Textures/grasshopper_black.png index 7b4042c..da6c15a 100644 Binary files a/InsectTiles/Assets/Textures/grasshopper_black.png and b/InsectTiles/Assets/Textures/grasshopper_black.png differ diff --git a/InsectTiles/Assets/Textures/grasshopper_white.png b/InsectTiles/Assets/Textures/grasshopper_white.png index c7442b5..b21b0a5 100644 Binary files a/InsectTiles/Assets/Textures/grasshopper_white.png and b/InsectTiles/Assets/Textures/grasshopper_white.png differ diff --git a/InsectTiles/Assets/Textures/ladybug_black.png b/InsectTiles/Assets/Textures/ladybug_black.png index 7d8fe31..4851575 100644 Binary files a/InsectTiles/Assets/Textures/ladybug_black.png and b/InsectTiles/Assets/Textures/ladybug_black.png differ diff --git a/InsectTiles/Assets/Textures/ladybug_white.png b/InsectTiles/Assets/Textures/ladybug_white.png index b51bb44..4227328 100644 Binary files a/InsectTiles/Assets/Textures/ladybug_white.png and b/InsectTiles/Assets/Textures/ladybug_white.png differ diff --git a/InsectTiles/Assets/Textures/mosquito_black.png b/InsectTiles/Assets/Textures/mosquito_black.png index a28c83e..3c16e6f 100644 Binary files a/InsectTiles/Assets/Textures/mosquito_black.png and b/InsectTiles/Assets/Textures/mosquito_black.png differ diff --git a/InsectTiles/Assets/Textures/mosquito_white.png b/InsectTiles/Assets/Textures/mosquito_white.png index e177a24..b55ea79 100644 Binary files a/InsectTiles/Assets/Textures/mosquito_white.png and b/InsectTiles/Assets/Textures/mosquito_white.png differ diff --git a/InsectTiles/Assets/Textures/pillbug_black.png b/InsectTiles/Assets/Textures/pillbug_black.png index b6ff31d..c9e754b 100644 Binary files a/InsectTiles/Assets/Textures/pillbug_black.png and b/InsectTiles/Assets/Textures/pillbug_black.png differ diff --git a/InsectTiles/Assets/Textures/pillbug_white.png b/InsectTiles/Assets/Textures/pillbug_white.png index 4f25626..8b0f51a 100644 Binary files a/InsectTiles/Assets/Textures/pillbug_white.png and b/InsectTiles/Assets/Textures/pillbug_white.png differ diff --git a/InsectTiles/Assets/Textures/spider_black.png b/InsectTiles/Assets/Textures/spider_black.png index 2c7f086..1311c51 100644 Binary files a/InsectTiles/Assets/Textures/spider_black.png and b/InsectTiles/Assets/Textures/spider_black.png differ diff --git a/InsectTiles/Assets/Textures/spider_white.png b/InsectTiles/Assets/Textures/spider_white.png index b029ada..f69d3c0 100644 Binary files a/InsectTiles/Assets/Textures/spider_white.png and b/InsectTiles/Assets/Textures/spider_white.png differ diff --git a/MovementBehaviour/Prefabs/MovementBehaviourAnt.gd b/MovementBehaviour/Prefabs/MovementBehaviourAnt.gd index de60368..3874897 100644 --- a/MovementBehaviour/Prefabs/MovementBehaviourAnt.gd +++ b/MovementBehaviour/Prefabs/MovementBehaviourAnt.gd @@ -6,29 +6,26 @@ class_name MovementBehaviourAnt # Maybe better: Get al "placecable tiles" from the map, go over those. Might be faster but more complicated func simulate_move_recursive(start: Vector4i, exclude: Array[Vector4i], map: HexGrid, visited_cells: Array[Vector4i] = []) -> Array[Vector4i]: - var visited = visited_cells var possible: Array[Vector4i] = [] - - #if max_num < 1: - # return [start] for neighbour in map.get_empty_neighbours(start): - if neighbour in visited: + if neighbour in visited_cells: + continue + + if not map.is_position_on_hive(neighbour): continue if not map.can_reach(start, neighbour): continue + visited_cells.push_back(neighbour) + simulate_move_recursive(neighbour, exclude, map, visited_cells) + var same_neighbours = map.get_same_neighbours(start, neighbour) for e in exclude: same_neighbours.erase(e) - - if same_neighbours.size() > 0: - visited.append(neighbour) - print("yay?") - possible.append_array(simulate_move_recursive(neighbour, exclude, map, visited)) - return possible + return visited_cells func get_available_spaces(pos: Vector4i, map: HexGrid) -> Array[Vector4i]: var possible_places: Array[Vector4i] = [] diff --git a/MovementBehaviour/Prefabs/MovementBehaviourBee.gd b/MovementBehaviour/Prefabs/MovementBehaviourBee.gd index c821460..7401d9e 100644 --- a/MovementBehaviour/Prefabs/MovementBehaviourBee.gd +++ b/MovementBehaviour/Prefabs/MovementBehaviourBee.gd @@ -3,6 +3,8 @@ class_name MovementBehaviourBee func get_available_spaces(pos: Vector4i, map: HexGrid) -> Array[Vector4i]: var potential_spaces = map.get_empty_neighbours(pos) + + print(potential_spaces) var target_spaces: Array[Vector4i] = [] diff --git a/MovementBehaviour/Prefabs/MovementBehaviourBeetle.gd b/MovementBehaviour/Prefabs/MovementBehaviourBeetle.gd index 10886ff..70c73fa 100644 --- a/MovementBehaviour/Prefabs/MovementBehaviourBeetle.gd +++ b/MovementBehaviour/Prefabs/MovementBehaviourBeetle.gd @@ -1,2 +1,33 @@ extends MovementBehaviour class_name MovementBehaviourBeetle + +@export var max_movement_reach: int = 1 + +func simulate_move_recursive(start: Vector4i, max_num: int, map: HexGrid, visited_cells: Array[Vector4i] = []) -> Array[Vector4i]: + var visited = visited_cells.duplicate() + var possible: Array[Vector4i] = [] + + visited.append(start) + + if max_num < 1: + return [start] + + for neighbour in map.get_neighbours(start, true): + if neighbour in visited: + continue + + # can reach... can_reach should only apply to our current level + if not map.can_reach(start, neighbour): + continue + + visited.append(neighbour) + possible.append_array(simulate_move_recursive(neighbour, max_num - 1, map, visited)) + + return possible + +func get_available_spaces(pos: Vector4i, map: HexGrid) -> Array[Vector4i]: + var possible_places: Array[Vector4i] = [] + + possible_places = simulate_move_recursive(pos, max_movement_reach, map) + + return possible_places diff --git a/MovementBehaviour/Prefabs/MovementBehaviourLadybug.gd b/MovementBehaviour/Prefabs/MovementBehaviourLadybug.gd index d632ca9..91509f1 100644 --- a/MovementBehaviour/Prefabs/MovementBehaviourLadybug.gd +++ b/MovementBehaviour/Prefabs/MovementBehaviourLadybug.gd @@ -1,2 +1,40 @@ extends MovementBehaviour class_name MovementBehaviourLadybug + +@export var max_movement_reach: int = 3 + +func simulate_move_recursive(start: Vector4i, max_num: int, exclude: Array[Vector4i], map: HexGrid, visited_cells: Array[Vector4i] = []) -> Array[Vector4i]: + var visited = visited_cells.duplicate() + var possible: Array[Vector4i] = [] + + visited.append(start) + + if max_num < 1: + return [start] + + var neighbours: Array[Vector4i] = [] + if max_num > 1: + neighbours = map.get_neighbours(start).filter(map.is_cell_not_empty) + else: + neighbours = map.get_empty_neighbours(start) + + for neighbour in neighbours: + if neighbour in visited: + continue + + #var same_neighbours = map.get_same_neighbours(start, neighbour) + #for e in exclude: + #same_neighbours.erase(e) + + #if same_neighbours.size() > 0: + visited.append(neighbour) + possible.append_array(simulate_move_recursive(neighbour, max_num - 1, exclude, map, visited)) + + return possible + +func get_available_spaces(pos: Vector4i, map: HexGrid) -> Array[Vector4i]: + var possible_places: Array[Vector4i] = [] + + possible_places = simulate_move_recursive(pos, max_movement_reach, [pos], map) + + return possible_places diff --git a/MovementBehaviour/Prefabs/MovementBehaviourMosquito.gd b/MovementBehaviour/Prefabs/MovementBehaviourMosquito.gd index 05380a3..c4b0ae6 100644 --- a/MovementBehaviour/Prefabs/MovementBehaviourMosquito.gd +++ b/MovementBehaviour/Prefabs/MovementBehaviourMosquito.gd @@ -1,2 +1,13 @@ extends MovementBehaviour class_name MovementBehaviourMosquito + +func get_available_spaces(pos: Vector4i, map: HexGrid) -> Array[Vector4i]: + var target_spaces: Array[Vector4i] = [] + + for neighbour in map.get_neighbours(pos): + if map.is_cell_empty(neighbour): + continue + + target_spaces.append_array(map.get_tile(neighbour).resource.movement_behaviour.get_available_spaces(pos, map)) + + return target_spaces diff --git a/MovementBehaviour/Prefabs/MovementBehaviourPillbug.gd b/MovementBehaviour/Prefabs/MovementBehaviourPillbug.gd index a314415..ae31f63 100644 --- a/MovementBehaviour/Prefabs/MovementBehaviourPillbug.gd +++ b/MovementBehaviour/Prefabs/MovementBehaviourPillbug.gd @@ -1,2 +1,13 @@ extends MovementBehaviour class_name MovementBehaviourPillbug + +func get_available_spaces(pos: Vector4i, map: HexGrid) -> Array[Vector4i]: + var potential_spaces = map.get_empty_neighbours(pos) + + var target_spaces: Array[Vector4i] = [] + + for neighbour in potential_spaces: + if map.can_reach(pos, neighbour): + target_spaces.append(neighbour) + + return target_spaces diff --git a/MovementBehaviour/Prefabs/MovementBehaviourSpider.gd b/MovementBehaviour/Prefabs/MovementBehaviourSpider.gd index 2e29953..975c1a2 100644 --- a/MovementBehaviour/Prefabs/MovementBehaviourSpider.gd +++ b/MovementBehaviour/Prefabs/MovementBehaviourSpider.gd @@ -25,7 +25,6 @@ func simulate_move_recursive(start: Vector4i, max_num: int, exclude: Array[Vecto if same_neighbours.size() > 0: visited.append(neighbour) - print("yay?") possible.append_array(simulate_move_recursive(neighbour, max_num - 1, exclude, map, visited)) return possible diff --git a/Tile/Prefabs/Ant.tres b/Tile/Prefabs/Ant.tres index 9d9d0ae..aa4b7de 100644 --- a/Tile/Prefabs/Ant.tres +++ b/Tile/Prefabs/Ant.tres @@ -1,13 +1,18 @@ -[gd_resource type="Resource" script_class="TileResource" load_steps=5 format=3 uid="uid://x25q4bbhxcp3"] +[gd_resource type="Resource" script_class="TileResource" load_steps=7 format=3 uid="uid://x25q4bbhxcp3"] [ext_resource type="Material" uid="uid://cxosyb7s454wj" path="res://InsectTiles/Materials/Ant_Black.tres" id="1_yunq4"] [ext_resource type="Material" uid="uid://cq13vo8hnk7k1" path="res://InsectTiles/Materials/Ant_White.tres" id="2_8sds4"] [ext_resource type="Script" path="res://Tile/TileResource.gd" id="3_n4n55"] +[ext_resource type="Script" path="res://MovementBehaviour/Prefabs/MovementBehaviourAnt.gd" id="3_thq0t"] [ext_resource type="Texture2D" uid="uid://0sqfwl6wjdtl" path="res://InsectTiles/Assets/UI/ant.png" id="4_canjv"] +[sub_resource type="Resource" id="Resource_m8bed"] +script = ExtResource("3_thq0t") + [resource] script = ExtResource("3_n4n55") tile_name = "Ant" +movement_behaviour = SubResource("Resource_m8bed") material_black = ExtResource("1_yunq4") material_white = ExtResource("2_8sds4") ui_texture = ExtResource("4_canjv") diff --git a/Tile/Prefabs/Beetle.tres b/Tile/Prefabs/Beetle.tres index 30f72f3..5c9adfc 100644 --- a/Tile/Prefabs/Beetle.tres +++ b/Tile/Prefabs/Beetle.tres @@ -1,13 +1,19 @@ -[gd_resource type="Resource" script_class="TileResource" load_steps=5 format=3 uid="uid://bn5na10diacrw"] +[gd_resource type="Resource" script_class="TileResource" load_steps=7 format=3 uid="uid://bn5na10diacrw"] [ext_resource type="Material" uid="uid://bbx3b1qialq3l" path="res://InsectTiles/Materials/Beetle_Black.tres" id="1_cbjw0"] [ext_resource type="Material" uid="uid://cas4k78kf1c0x" path="res://InsectTiles/Materials/Beetle_White.tres" id="2_txjyp"] [ext_resource type="Script" path="res://Tile/TileResource.gd" id="3_g4s7x"] +[ext_resource type="Script" path="res://MovementBehaviour/Prefabs/MovementBehaviourBeetle.gd" id="3_ik3ft"] [ext_resource type="Texture2D" uid="uid://dwewgsgd0gasi" path="res://InsectTiles/Assets/UI/beetle.png" id="4_iki3w"] +[sub_resource type="Resource" id="Resource_lc7ln"] +script = ExtResource("3_ik3ft") +max_movement_reach = 1 + [resource] script = ExtResource("3_g4s7x") -tile_name = "Spider" +tile_name = "Beetle" +movement_behaviour = SubResource("Resource_lc7ln") material_black = ExtResource("1_cbjw0") material_white = ExtResource("2_txjyp") ui_texture = ExtResource("4_iki3w") diff --git a/Tile/Prefabs/Ladybug.tres b/Tile/Prefabs/Ladybug.tres index 8881967..7930d6f 100644 --- a/Tile/Prefabs/Ladybug.tres +++ b/Tile/Prefabs/Ladybug.tres @@ -1,13 +1,19 @@ -[gd_resource type="Resource" script_class="TileResource" load_steps=5 format=3 uid="uid://daieqla4g6pnx"] +[gd_resource type="Resource" script_class="TileResource" load_steps=7 format=3 uid="uid://daieqla4g6pnx"] [ext_resource type="Material" uid="uid://ymfmmwtlmikl" path="res://InsectTiles/Materials/Ladybug_Black.tres" id="1_1577p"] [ext_resource type="Material" uid="uid://c5oxmuvm8ngp6" path="res://InsectTiles/Materials/Ladybug_White.tres" id="2_6ewhc"] +[ext_resource type="Script" path="res://MovementBehaviour/Prefabs/MovementBehaviourLadybug.gd" id="3_hgd41"] [ext_resource type="Script" path="res://Tile/TileResource.gd" id="3_kco06"] [ext_resource type="Texture2D" uid="uid://c8tm1giuiexap" path="res://InsectTiles/Assets/UI/ladybug.png" id="4_ad3wk"] +[sub_resource type="Resource" id="Resource_qjpfb"] +script = ExtResource("3_hgd41") +max_movement_reach = 3 + [resource] script = ExtResource("3_kco06") tile_name = "Ladybug" +movement_behaviour = SubResource("Resource_qjpfb") material_black = ExtResource("1_1577p") material_white = ExtResource("2_6ewhc") ui_texture = ExtResource("4_ad3wk") diff --git a/Tile/Prefabs/Mosquito.tres b/Tile/Prefabs/Mosquito.tres index 12d6239..182588f 100644 --- a/Tile/Prefabs/Mosquito.tres +++ b/Tile/Prefabs/Mosquito.tres @@ -1,13 +1,18 @@ -[gd_resource type="Resource" script_class="TileResource" load_steps=5 format=3 uid="uid://5gxoun8c6a2i"] +[gd_resource type="Resource" script_class="TileResource" load_steps=7 format=3 uid="uid://5gxoun8c6a2i"] [ext_resource type="Material" uid="uid://c3cgwluy7660h" path="res://InsectTiles/Materials/Mosquito_Black.tres" id="1_lthri"] [ext_resource type="Material" uid="uid://4d8v7sxf1udv" path="res://InsectTiles/Materials/Mosquito_White.tres" id="2_qdl6y"] [ext_resource type="Script" path="res://Tile/TileResource.gd" id="3_5xhnv"] +[ext_resource type="Script" path="res://MovementBehaviour/Prefabs/MovementBehaviourMosquito.gd" id="3_gkh5p"] [ext_resource type="Texture2D" uid="uid://sw4ar13a5qxx" path="res://InsectTiles/Assets/UI/mosquito.png" id="4_rp6ff"] +[sub_resource type="Resource" id="Resource_0j1qw"] +script = ExtResource("3_gkh5p") + [resource] script = ExtResource("3_5xhnv") tile_name = "Mosquito" +movement_behaviour = SubResource("Resource_0j1qw") material_black = ExtResource("1_lthri") material_white = ExtResource("2_qdl6y") ui_texture = ExtResource("4_rp6ff") diff --git a/Tile/Prefabs/Pillbug.tres b/Tile/Prefabs/Pillbug.tres index 6414ba0..80fa676 100644 --- a/Tile/Prefabs/Pillbug.tres +++ b/Tile/Prefabs/Pillbug.tres @@ -1,13 +1,18 @@ -[gd_resource type="Resource" script_class="TileResource" load_steps=5 format=3 uid="uid://dk0ndwv8i2rsb"] +[gd_resource type="Resource" script_class="TileResource" load_steps=7 format=3 uid="uid://dk0ndwv8i2rsb"] [ext_resource type="Material" uid="uid://4vol6qmah4dx" path="res://InsectTiles/Materials/Pillbug_Black.tres" id="1_45nom"] [ext_resource type="Material" uid="uid://drmm6ppt50j7s" path="res://InsectTiles/Materials/Pillbug_White.tres" id="2_b3rd8"] +[ext_resource type="Script" path="res://MovementBehaviour/Prefabs/MovementBehaviourPillbug.gd" id="3_2v3p1"] [ext_resource type="Script" path="res://Tile/TileResource.gd" id="3_j2ho1"] [ext_resource type="Texture2D" uid="uid://evg5tvmw8ehl" path="res://InsectTiles/Assets/UI/pillbug.png" id="4_dg5at"] +[sub_resource type="Resource" id="Resource_5iy41"] +script = ExtResource("3_2v3p1") + [resource] script = ExtResource("3_j2ho1") tile_name = "Pillbug" +movement_behaviour = SubResource("Resource_5iy41") material_black = ExtResource("1_45nom") material_white = ExtResource("2_b3rd8") ui_texture = ExtResource("4_dg5at") diff --git a/Tile/Tile.gd b/Tile/Tile.gd index 6147fc2..5591022 100644 --- a/Tile/Tile.gd +++ b/Tile/Tile.gd @@ -102,6 +102,7 @@ func _process(delta): ##GameEvents.insect_tile_selection_request_failed.emit(tile) #return + print(resource) GameEvents.insect_tile_selected.emit(self) diff --git a/hex_outline_bottom.res b/hex_outline_bottom.res index 8d39613..b4acd19 100644 Binary files a/hex_outline_bottom.res and b/hex_outline_bottom.res differ diff --git a/hex_outline_material.tres b/hex_outline_material.tres index 43d69c1..908825e 100644 --- a/hex_outline_material.tres +++ b/hex_outline_material.tres @@ -2,7 +2,7 @@ [sub_resource type="Gradient" id="Gradient_8056d"] offsets = PackedFloat32Array(0, 0.0549828, 0.945017) -colors = PackedColorArray(1, 1, 1, 0, 1, 1, 1, 0.52549, 1, 1, 1, 0) +colors = PackedColorArray(1, 1, 1, 0, 1, 1, 1, 0.772549, 1, 1, 1, 0) [sub_resource type="GradientTexture1D" id="GradientTexture1D_5kfu4"] gradient = SubResource("Gradient_8056d")