123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- extends Tween
- # Drive moves for liners
- const MINIMAL_DURATION = 0.01
- export var default_duration = 0.1
- export var drift_duration = 0.2
- export var boost_bonus = 0.02
- var current_duration = default_duration
- var current_bonus = 0.0
- func move_char(character, target):
- move_char_during(character, target, get_computed_duration())
- func move_char_during(c, target, duration):
- interpolate_property(c, "position", c.get_position(), target, duration, Tween.TRANS_LINEAR, Tween.EASE_OUT_IN)
- func rotate_char(character, from, to):
- rotate_char_during(character, from, to, get_computed_duration())
- func rotate_char_during(c, from, to, duration):
- interpolate_property(c, "rotation_degrees", from, to, duration, Tween.TRANS_LINEAR, Tween.EASE_OUT)
- func set_boost(value:int):
- current_bonus = boost_bonus * value
- func get_computed_duration():
- var duration = current_duration - current_bonus
- if duration < MINIMAL_DURATION :
- return MINIMAL_DURATION
- return duration
- func _on_Player_drift_started():
- current_duration = drift_duration
- func _on_Player_drift_ended():
- current_duration = default_duration
|