fix: bind callbacks before passing to tween_callback, tighten backpack hitbox
- Godot 4's CallbackTweener doesn't have .bind() — move .bind() call inside tween_callback() for 3 callback sites - Shrink InventoryBackpack Control to 60x60 (offset_right -70) so click area matches the visible BackpackIcon square
This commit is contained in:
@@ -72,7 +72,7 @@ func _transition_to_idle() -> void:
|
||||
_animating = true
|
||||
tween.tween_property(backpack_icon, "rotation", 0.0, 0.35).set_trans(Tween.TRANS_LINEAR)
|
||||
tween.tween_property(backpack_icon, "position", backpack_icon.position, 0.35).set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_IN)
|
||||
tween.tween_callback(_on_transition_complete).bind(State.IDLE)
|
||||
tween.tween_callback(_on_transition_complete.bind(State.IDLE))
|
||||
|
||||
func _transition_to_open() -> void:
|
||||
var can_open = _check_guards()
|
||||
@@ -88,7 +88,7 @@ func _transition_to_open() -> void:
|
||||
_animating = true
|
||||
tween.tween_property(backpack_icon, "rotation", PI / 4, 0.35).set_trans(Tween.TRANS_LINEAR)
|
||||
tween.tween_property(backpack_icon, "position", Vector2(backpack_icon.position.x + 20, backpack_icon.position.y + 20), 0.35).set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_IN)
|
||||
tween.tween_callback(_on_transition_complete).bind(State.OPEN)
|
||||
tween.tween_callback(_on_transition_complete.bind(State.OPEN))
|
||||
tween.tween_callback(overlay_show_requested.emit)
|
||||
|
||||
func _transition_to_selected() -> void:
|
||||
@@ -105,7 +105,7 @@ func _transition_to_selected() -> void:
|
||||
floating_item.visible = true
|
||||
floating_item.modulate = Color(1, 1, 1, 0)
|
||||
tween.tween_property(floating_item, "modulate", Color(1, 1, 1, 1), 0.5).set_trans(Tween.TRANS_LINEAR)
|
||||
tween.tween_callback(_on_transition_complete).bind(State.SELECTED)
|
||||
tween.tween_callback(_on_transition_complete.bind(State.SELECTED))
|
||||
|
||||
func _transition_to_acquire() -> void:
|
||||
if _state == State.ACQUIRE or _state == State.REMOVE:
|
||||
|
||||
@@ -7,7 +7,7 @@ layout_mode = 3
|
||||
anchors_preset = 2
|
||||
anchor_right = 1.0
|
||||
offset_top = 10.0
|
||||
offset_right = -10.0
|
||||
offset_right = -70.0
|
||||
offset_bottom = 70.0
|
||||
script = ExtResource("1")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user