handle interruping animations better

This commit is contained in:
mehbark 2025-05-29 17:00:37 -04:00
parent bd29a6d9b4
commit fe623236c1
3 changed files with 7 additions and 0 deletions

View file

@ -82,6 +82,7 @@ func do_step():
pieces_diagonal.sort_custom(magnitude_sort)
if last_tween:
last_tween.custom_step(413)
last_tween.kill()
var tween := get_tree().create_tween()
last_tween = tween

View file

@ -52,6 +52,7 @@ func _process(delta: float) -> void:
[time, Engine.get_frames_per_second(), move_hold_time, arrf(move_hold_time)]
var slowmo := Input.is_action_pressed("slowmo");
$SlowmoIndicator.text = "slowmo" if slowmo else ""
# TODO: only slowmo during rolltime?
Engine.time_scale = slowmo_speed if slowmo else 1.0
# TODO: this is kinda comically slow BUT STOP WORKING ON THE GAME
AudioServer.playback_speed_scale = slowmo_speed if slowmo else 1.0

View file

@ -25,8 +25,13 @@ func pos_of_lpos(pos: Vector2i, y := 0.0) -> Vector3:
func target_pos() -> Vector3:
return pos_of_lpos(lpos, position.y) + Vector3(0.5, 0, 0.5)
var last_move_tween: Tween = null
func tween_to_target(tween := get_tree().create_tween()):
if last_move_tween:
last_move_tween.custom_step(413)
last_move_tween.kill()
tween.tween_property(self, "position", target_pos(), anim_time)
last_move_tween = tween
func lpos_of_pos(pos: Vector3) -> Vector2i:
return Vector2i(int(pos.x), int(pos.z))