diff --git a/scripts/items/honeydew.gd b/scripts/items/honeydew.gd index 85fa6ab..2e87fa1 100644 --- a/scripts/items/honeydew.gd +++ b/scripts/items/honeydew.gd @@ -1,11 +1,11 @@ extends Interactable class_name Honeydew -signal moved +signal tween_finished const HEIGHT_OFFSET: float = 0.1 -const MOVE_SPEED: float = 8 -const MOVE_ARC_HEIGHT: float = 0.5 +const TWEEN_SPEED: float = 8 +const TWEEN_ARC_HEIGHT: float = 0.5 var carried: bool = false @@ -29,12 +29,12 @@ func _process(delta: float) -> void: if _moving_timer <= 0: if _move_to != Vector3.ZERO: _move_to = Vector3.ZERO - moved.emit() + tween_finished.emit() return - _moving_timer -= delta * MOVE_SPEED + _moving_timer -= delta * TWEEN_SPEED global_position = _move_from.bezier_interpolate( - _move_from + Vector3.UP * MOVE_ARC_HEIGHT, - _move_to + Vector3.UP * MOVE_ARC_HEIGHT, + _move_from + Vector3.UP * TWEEN_ARC_HEIGHT, + _move_to + Vector3.UP * TWEEN_ARC_HEIGHT, _move_to, (1 - _moving_timer), ) @@ -58,7 +58,7 @@ func set_carried(on: bool) -> void: collision_shape.disabled = carried -func start_moving(to: Vector3) -> Honeydew: +func start_tweening(to: Vector3) -> Honeydew: _moving_timer = 1 _move_from = global_position _move_to = to diff --git a/scripts/units/components/gathering.gd b/scripts/units/components/gathering.gd index 0d86b7a..68484db 100644 --- a/scripts/units/components/gathering.gd +++ b/scripts/units/components/gathering.gd @@ -142,9 +142,9 @@ func _pick_up() -> void: _carrying_items.append(_target) _target.set_carried(true) audio_player.play_sound(SoundManager.swoosh()) - await _target.start_moving( + await _target.start_tweening( _get_nth_pile_pos(_carrying_items.size() - 1) - ).moved + ).tween_finished audio_player.play_sound(SoundManager.pop()) await get_tree().create_timer(_pickup_interval).timeout @@ -168,7 +168,7 @@ func _deposit() -> void: var item := _carrying_items.pop_back() as Honeydew audio_player.play_sound(SoundManager.swoosh()) - await item.start_moving(_unit.anthill.global_position).moved + await item.start_tweening(_unit.anthill.global_position).tween_finished audio_player.play_sound(SoundManager.tok()) item.remove_from_spawner()