fix: make inventory backpack visible by instancing in Game.tscn and fixing Tween API
- Add InventoryBackpack under HUD CanvasLayer (layer 5) in Game.tscn - Add InventoryOverlay under InventoryOverlayLayer CanvasLayer (layer 10) - Fix Tween.TRANS_SINE_IN -> .set_trans(TRANS_SINE).set_ease(EASE_IN) in InventoryBackpack.gd (Godot 4.6 split transition and easing APIs)
This commit is contained in:
@@ -71,7 +71,7 @@ func _transition_to_idle() -> void:
|
||||
_active_tween = tween
|
||||
_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_IN)
|
||||
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)
|
||||
|
||||
func _transition_to_open() -> void:
|
||||
@@ -87,7 +87,7 @@ func _transition_to_open() -> void:
|
||||
_active_tween = tween
|
||||
_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_IN)
|
||||
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(overlay_show_requested.emit)
|
||||
|
||||
@@ -222,7 +222,9 @@ func _on_inventory_changed() -> void:
|
||||
_update_floating_item()
|
||||
|
||||
func _gui_input(event: InputEvent) -> void:
|
||||
|
||||
if event is InputEventMouseButton and event.pressed and event.button_index == 1:
|
||||
print("OBTAINED")
|
||||
if _state == State.IDLE:
|
||||
transition_to(State.OPEN)
|
||||
elif _state == State.OPEN:
|
||||
|
||||
Reference in New Issue
Block a user