Clean up player scripts

This commit is contained in:
Mathilde Grapin 2023-06-28 21:29:55 +02:00
parent a1e8f9b34d
commit a08afcb147
7 changed files with 75 additions and 75 deletions

View file

@ -11,12 +11,12 @@ func _ready():
target.y += Y_OFFSET
var player = get_node("/root/Main/TileMap/Player")
assert(player)
player.hit.connect(_on_player_hit)
player.hit_ball.connect(_on_player_hit_ball)
func _physics_process(delta):
position = position.move_toward(target, delta * speed)
func _on_player_hit():
func _on_player_hit_ball():
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)