Prepared Movement behaviour. Fixed multi-tile placement bug
This commit is contained in:
parent
62eef907d3
commit
397082f966
17 changed files with 395 additions and 75 deletions
|
|
@ -1,12 +1,24 @@
|
|||
extends ActionBehaviour
|
||||
class_name ActionBehaviourPillbug
|
||||
|
||||
func select_targets(source_pos: Vector4i, map: HexGrid): # -> Array[InsectTile]:
|
||||
func do_action(source_tile: InsectTile, action_tile: InsectTile, map: HexGrid) -> void:
|
||||
pass
|
||||
|
||||
func get_targets(source_pos: Vector4i, map: HexGrid) -> Array[InsectTile]:
|
||||
var neighbours = map.get_neighbours(source_pos)
|
||||
var possible_action_targets: Array[InsectTile] = []
|
||||
|
||||
for neighbour in neighbours:
|
||||
var tile = map.get_tile(neighbour)
|
||||
if tile != null:
|
||||
possible_action_targets.push_back(tile)
|
||||
if not tile.is_in_stack() and tile.can_move():
|
||||
possible_action_targets.push_back(tile)
|
||||
|
||||
GameEvents.insect_tiles_selected_for_action.emit(source_pos, possible_action_targets)
|
||||
#GameEvents.insect_tiles_selected_for_action.emit(source_pos, possible_action_targets)
|
||||
|
||||
return possible_action_targets
|
||||
|
||||
|
||||
# 2nd level has to be clear (move through narrow gap rule)
|
||||
# We could do the following: Get neighbours in 2nd level of source (pillbug) and target
|
||||
# we we have two overlapping/same neighbours, we have a narrow gap and can't move the target
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue