diff --git a/src/classes/Unit.gd b/src/classes/Unit.gd index f4ec9dc..dbeb87e 100644 --- a/src/classes/Unit.gd +++ b/src/classes/Unit.gd @@ -78,7 +78,7 @@ func move(movement : Vector2): z_index = 100 -func attack(damage : int, points : int, pattern : PoolVector2Array): #TODO +func attack(damage : int, points : int, pattern : PoolVector2Array): if attack_points != 0: #change animation to attacking $AnimationPlayer.play("Attack front") @@ -87,9 +87,10 @@ func attack(damage : int, points : int, pattern : PoolVector2Array): #TODO # and calls their attacked method for i in range(pattern.size()): var coord = Grid.position_to_coordinates(position, height) - var selected_name = Grid.grid[coord.x + pattern[i].x][coord.y + pattern[i].y][0] + var selected_name = Grid.grid[coord.x + pattern[i].x][coord.y + pattern[i].y] + print(coord.x + pattern[i].x, coord.y + pattern[i].y) if selected_name: - get_node(("../" + selected_name)).attacked(damage, "") #TODO effects implementation + get_node(("../" + selected_name[0])).attacked(damage, "") #TODO effects implementation #change the attack points left attack_points = max(attack_points - points, 0) #keep >= 0