Play ball with the enemy
Enemy can return the ball to the player
This commit is contained in:
parent
332c0fb0e1
commit
e0633efcbe
14 changed files with 139 additions and 44 deletions
|
@ -1,6 +1,7 @@
|
|||
class_name Ball
|
||||
extends CharacterBody2D
|
||||
|
||||
signal notify_enemy
|
||||
const Y_OFFSET = -10
|
||||
var speed = 100
|
||||
var target = Vector2.ZERO
|
||||
|
@ -19,4 +20,7 @@ func _on_player_hit():
|
|||
var rand_cell: Vector2i = tile_map.get_random_top_cell()
|
||||
tile_map.reset_and_set_target_cell(rand_cell)
|
||||
target = tile_map.map_to_local(rand_cell) + Vector2(0, Y_OFFSET)
|
||||
|
||||
notify_enemy.emit()
|
||||
|
||||
func aim_to_bottom() -> bool:
|
||||
return tile_map.is_in_bottom_area(target)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue