Play ball with the enemy

Enemy can return the ball to the player
This commit is contained in:
Mathilde Grapin 2023-06-27 21:25:32 +02:00
parent 332c0fb0e1
commit e0633efcbe
14 changed files with 139 additions and 44 deletions

View file

@ -49,6 +49,16 @@ func get_random_bottom_cell() -> Vector2i:
return Vector2i(rand_width, rand_height)
func is_in_bottom_area(local_position: Vector2) -> bool:
var map_position = local_to_map(local_position)
var middle_height = floor(map_height / 2.0)
var bottom_min_height = middle_height + 1
var bottom_max_height = map_height - 1
return map_position.y >= bottom_min_height && map_position.y <= map_height
# Debug helper functions
func reset_and_set_target_cell(cell: Vector2i):
reset_and_set_cell(current_target_cell, cell, target_tile_source_id)
@ -61,3 +71,4 @@ func reset_and_set_cell(current_cell: Vector2i, cell: Vector2i, tile_source_id:
set_cell(0, current_cell, ground_tile_source_id, Vector2i(0, 0), 0)
set_cell(0, cell, tile_source_id, Vector2i(0, 0), 0)
current_cell = cell