Implemented most movement. TODO: Pillbug ability. And find and fix bugs witht he movement. TODO: Deselect when not movable

This commit is contained in:
Sch1nken 2024-03-14 21:17:16 +01:00
parent 11f8a71f52
commit 76e4d6be34
33 changed files with 184 additions and 61 deletions

View file

@ -11,7 +11,10 @@ const default_insects = {
preload("res://Tile/Prefabs/Ant.tres"): 3, preload("res://Tile/Prefabs/Ant.tres"): 3,
preload("res://Tile/Prefabs/Beetle.tres"): 2, preload("res://Tile/Prefabs/Beetle.tres"): 2,
preload("res://Tile/Prefabs/Grasshopper.tres"): 3, 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. # Called when the node enters the scene tree for the first time.

View file

@ -26,26 +26,7 @@ var used_cells: Dictionary = {}
@export var layer_height: float = 0.4 @export var layer_height: float = 0.4
# have all used_cells be saved as Vector4i (q, r, s, y) # 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]
class AxialCoordinates: class AxialCoordinates:
var q: float var q: float
@ -132,27 +113,31 @@ func is_cell_not_empty(coords: Vector4i) -> bool:
func get_empty_neighbours(coords: Vector4i) -> Array[Vector4i]: func get_empty_neighbours(coords: Vector4i) -> Array[Vector4i]:
return get_neighbours(coords).filter(is_cell_empty) 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 [ return [
Vector4i(coords.x + 1, coords.y, coords.z - 1, coords.w), Vector4i(coords.x + 1, coords.y, coords.z - 1, layer),
Vector4i(coords.x + 1, coords.y - 1, coords.z, coords.w), Vector4i(coords.x + 1, coords.y - 1, coords.z, layer),
Vector4i(coords.x, coords.y - 1, coords.z + 1, coords.w), Vector4i(coords.x, coords.y - 1, coords.z + 1, layer),
Vector4i(coords.x - 1, coords.y, coords.z + 1, coords.w), Vector4i(coords.x - 1, coords.y, coords.z + 1, layer),
Vector4i(coords.x - 1, coords.y + 1, coords.z, coords.w), Vector4i(coords.x - 1, coords.y + 1, coords.z, layer),
Vector4i(coords.x, coords.y + 1, coords.z - 1, coords.w) Vector4i(coords.x, coords.y + 1, coords.z - 1, layer)
] ]
var current_tile: Node3D var current_tile: Node3D
const HEX_OUTLINE = preload("res://hex_outline.tscn") 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: if used_cells.size() == 0:
return [Vector4i.ZERO] return [Vector4i.ZERO]
elif used_cells.size() == 1: elif used_cells.size() == 1:
var single_cell = used_cells.keys().front() var single_cell = used_cells.keys().front()
var neighbours = get_neighbours(single_cell) var neighbours = get_neighbours(single_cell)
var positions = [] var positions: Array[Vector4i] = []
for neighbour in neighbours: for neighbour in neighbours:
#var hex_pos = cube_to_world_pos(neighbour) #var hex_pos = cube_to_world_pos(neighbour)
@ -160,7 +145,7 @@ func get_placeable_positions(button: InsectButton) -> Array:
return positions return positions
var possible_placements: Dictionary = {} var possible_placements: Dictionary = {}
var positions = [] var positions: Array[Vector4i] = []
for hex in used_cells.keys(): for hex in used_cells.keys():
for neighbour in get_empty_neighbours(hex): 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: func get_right_neighbour(pos: Vector4i) -> Vector4i:
return Vector4i(-pos.y, -pos.z, -pos.x, 0) 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 # if we have 5 potential spaces it can never be blocked
var offset: Vector4i = Vector4i.ZERO var offset: Vector4i = Vector4i.ZERO
@ -201,14 +186,14 @@ func can_reach(start: Vector4i, target: Vector4i) -> bool:
var left = get_left_neighbour(offset) var left = get_left_neighbour(offset)
var right = get_right_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 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, 0) 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) return is_cell_empty(left_coord) or is_cell_empty(right_coord)
func _on_insect_selected(button: InsectButton, is_black: bool) -> void: func _on_insect_selected(button: InsectButton, is_black: bool) -> void:
var positions = get_placeable_positions(button) var positions = get_placeable_positions(button)
for p in positions: for p in positions:
var outline = HEX_OUTLINE.instantiate() var outline = HEX_OUTLINE.instantiate()
var hex_pos = cube_to_world_pos(p) var hex_pos = cube_to_world_pos(p)
outline.position = Vector3(hex_pos.x, 0.0, hex_pos.y) 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: func can_move(tile: InsectTile) -> bool:
return can_hive_exist_without_tile(tile) return can_hive_exist_without_tile(tile)
func create_move_positions() -> void:
pass
func _on_insect_tile_selected(tile: InsectTile) -> void: func _on_insect_tile_selected(tile: InsectTile) -> void:
if not can_hive_exist_without_tile(tile): if not can_hive_exist_without_tile(tile):
print("Would break hive")
return return
if tile.resource.movement_behaviour == null: if tile.resource.movement_behaviour == null:
print("no movement behaviour")
return return
var spaces = tile.resource.movement_behaviour.get_available_spaces(tile.coordinates, self) var spaces = tile.resource.movement_behaviour.get_available_spaces(tile.coordinates, self)
if spaces.is_empty(): if spaces.is_empty():
print("empty?")
#GameEvents.insect_tile_selection_request_failed.emit(tile) #GameEvents.insect_tile_selection_request_failed.emit(tile)
return return
@ -341,13 +326,29 @@ func _on_insect_tile_selected(tile: InsectTile) -> void:
var non_empty_neighbours = neighbours.filter(is_cell_not_empty) var non_empty_neighbours = neighbours.filter(is_cell_not_empty)
if non_empty_neighbours.size() == 1: 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() var occupied_neighbour = non_empty_neighbours.front()
if occupied_neighbour == tile.coordinates: if occupied_neighbour == tile.coordinates:
continue 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 outline = HEX_OUTLINE.instantiate()
var hex_pos = cube_to_world_pos(space) # flat_hex_to_world_position(AxialCoordinates.new(space.x, space.y)) 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.coordinates = space
outline.visible = true outline.visible = true
outline.insect_tile = tile outline.insect_tile = tile
@ -357,13 +358,15 @@ func _on_insect_tile_selected(tile: InsectTile) -> void:
placement_visualizer.add_child(outline) placement_visualizer.add_child(outline)
placements[space] = 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: func _on_insect_tile_moved(tile: InsectTile, target: Vector4i) -> void:
used_cells.erase(tile.coordinates) used_cells.erase(tile.coordinates)
var new_hex_pos = cube_to_world_pos(target) 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 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 current_hex_pos = tile.position
var sky_current_hex_pos = tile.position + Vector3(0.0, 20.0, 0.0) 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 return shared_neighbours
func is_position_on_hive(pos: Vector4i) -> bool: 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: 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 # 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 # DO BFS
var tiles_reached: Array = [] 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 tiles_available.size() <= 1:
# If we only have 1 or 2 total tiles, we can always move # If we only have 1 or 2 total tiles, we can always move

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 62 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 62 KiB

Before After
Before After

View file

@ -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 # 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]: 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] = [] var possible: Array[Vector4i] = []
#if max_num < 1:
# return [start]
for neighbour in map.get_empty_neighbours(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 continue
if not map.can_reach(start, neighbour): if not map.can_reach(start, neighbour):
continue continue
visited_cells.push_back(neighbour)
simulate_move_recursive(neighbour, exclude, map, visited_cells)
var same_neighbours = map.get_same_neighbours(start, neighbour) var same_neighbours = map.get_same_neighbours(start, neighbour)
for e in exclude: for e in exclude:
same_neighbours.erase(e) 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]: func get_available_spaces(pos: Vector4i, map: HexGrid) -> Array[Vector4i]:
var possible_places: Array[Vector4i] = [] var possible_places: Array[Vector4i] = []

View file

@ -3,6 +3,8 @@ class_name MovementBehaviourBee
func get_available_spaces(pos: Vector4i, map: HexGrid) -> Array[Vector4i]: func get_available_spaces(pos: Vector4i, map: HexGrid) -> Array[Vector4i]:
var potential_spaces = map.get_empty_neighbours(pos) var potential_spaces = map.get_empty_neighbours(pos)
print(potential_spaces)
var target_spaces: Array[Vector4i] = [] var target_spaces: Array[Vector4i] = []

View file

@ -1,2 +1,33 @@
extends MovementBehaviour extends MovementBehaviour
class_name MovementBehaviourBeetle 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

View file

@ -1,2 +1,40 @@
extends MovementBehaviour extends MovementBehaviour
class_name MovementBehaviourLadybug 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

View file

@ -1,2 +1,13 @@
extends MovementBehaviour extends MovementBehaviour
class_name MovementBehaviourMosquito 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

View file

@ -1,2 +1,13 @@
extends MovementBehaviour extends MovementBehaviour
class_name MovementBehaviourPillbug 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

View file

@ -25,7 +25,6 @@ func simulate_move_recursive(start: Vector4i, max_num: int, exclude: Array[Vecto
if same_neighbours.size() > 0: if same_neighbours.size() > 0:
visited.append(neighbour) visited.append(neighbour)
print("yay?")
possible.append_array(simulate_move_recursive(neighbour, max_num - 1, exclude, map, visited)) possible.append_array(simulate_move_recursive(neighbour, max_num - 1, exclude, map, visited))
return possible return possible

View file

@ -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://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="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://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"] [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] [resource]
script = ExtResource("3_n4n55") script = ExtResource("3_n4n55")
tile_name = "Ant" tile_name = "Ant"
movement_behaviour = SubResource("Resource_m8bed")
material_black = ExtResource("1_yunq4") material_black = ExtResource("1_yunq4")
material_white = ExtResource("2_8sds4") material_white = ExtResource("2_8sds4")
ui_texture = ExtResource("4_canjv") ui_texture = ExtResource("4_canjv")

View file

@ -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://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="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://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"] [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] [resource]
script = ExtResource("3_g4s7x") script = ExtResource("3_g4s7x")
tile_name = "Spider" tile_name = "Beetle"
movement_behaviour = SubResource("Resource_lc7ln")
material_black = ExtResource("1_cbjw0") material_black = ExtResource("1_cbjw0")
material_white = ExtResource("2_txjyp") material_white = ExtResource("2_txjyp")
ui_texture = ExtResource("4_iki3w") ui_texture = ExtResource("4_iki3w")

View file

@ -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://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="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="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"] [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] [resource]
script = ExtResource("3_kco06") script = ExtResource("3_kco06")
tile_name = "Ladybug" tile_name = "Ladybug"
movement_behaviour = SubResource("Resource_qjpfb")
material_black = ExtResource("1_1577p") material_black = ExtResource("1_1577p")
material_white = ExtResource("2_6ewhc") material_white = ExtResource("2_6ewhc")
ui_texture = ExtResource("4_ad3wk") ui_texture = ExtResource("4_ad3wk")

View file

@ -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://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="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://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"] [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] [resource]
script = ExtResource("3_5xhnv") script = ExtResource("3_5xhnv")
tile_name = "Mosquito" tile_name = "Mosquito"
movement_behaviour = SubResource("Resource_0j1qw")
material_black = ExtResource("1_lthri") material_black = ExtResource("1_lthri")
material_white = ExtResource("2_qdl6y") material_white = ExtResource("2_qdl6y")
ui_texture = ExtResource("4_rp6ff") ui_texture = ExtResource("4_rp6ff")

View file

@ -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://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="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="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"] [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] [resource]
script = ExtResource("3_j2ho1") script = ExtResource("3_j2ho1")
tile_name = "Pillbug" tile_name = "Pillbug"
movement_behaviour = SubResource("Resource_5iy41")
material_black = ExtResource("1_45nom") material_black = ExtResource("1_45nom")
material_white = ExtResource("2_b3rd8") material_white = ExtResource("2_b3rd8")
ui_texture = ExtResource("4_dg5at") ui_texture = ExtResource("4_dg5at")

View file

@ -102,6 +102,7 @@ func _process(delta):
##GameEvents.insect_tile_selection_request_failed.emit(tile) ##GameEvents.insect_tile_selection_request_failed.emit(tile)
#return #return
print(resource)
GameEvents.insect_tile_selected.emit(self) GameEvents.insect_tile_selected.emit(self)

Binary file not shown.

View file

@ -2,7 +2,7 @@
[sub_resource type="Gradient" id="Gradient_8056d"] [sub_resource type="Gradient" id="Gradient_8056d"]
offsets = PackedFloat32Array(0, 0.0549828, 0.945017) 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"] [sub_resource type="GradientTexture1D" id="GradientTexture1D_5kfu4"]
gradient = SubResource("Gradient_8056d") gradient = SubResource("Gradient_8056d")