finish rolltime animation when player moves

This commit is contained in:
mehbark 2025-05-29 17:29:23 -04:00
parent 7e712e5468
commit 70f7ef747d
2 changed files with 9 additions and 3 deletions

View file

@ -64,6 +64,12 @@ func add_pieces(piece: Array[Piece]):
var last_tween: Tween = null
func finish_tween():
if last_tween:
last_tween.custom_step(413)
last_tween.kill()
last_tween = null
# here are the phases:
# cardinal velocity
# diagonal velocity
@ -81,9 +87,8 @@ func do_step():
pieces_cardinal.sort_custom(magnitude_sort)
pieces_diagonal.sort_custom(magnitude_sort)
if last_tween:
last_tween.custom_step(413)
last_tween.kill()
finish_tween()
var tween := get_tree().create_tween()
last_tween = tween

View file

@ -139,6 +139,7 @@ func step(move: Vector2i):
advance_level()
return
board.finish_tween()
var pos := player.lpos
var ball := board.find_piece_at(pos + move, func(p): return p.type == Piece.Type.Ball)
if board.passable_at(pos + move, true):