Skip to content

Commit

Permalink
FINAL FIX FOR INVENTORY UI!
Browse files Browse the repository at this point in the history
  • Loading branch information
sebashtioon committed Aug 25, 2024
1 parent 43777d1 commit 941d879
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions Scenes and Scripts/Scenes/Player/Player_SCRIPT.gd
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,13 @@ func _physics_process(delta):
if not is_on_floor():
velocity.y -= gravity * delta

# Allow gravity but prevent movement when the inventory is open
# Handle movement restrictions when the inventory is open
if GAME_STATE == "INVENTORY":
# If the player was in the air when the inventory was opened and they just landed, stop movement
if inventory_opened_in_air and is_on_floor():
# If the player is on the ground when the inventory is opened or lands, stop movement
if is_on_floor():
velocity.x = 0
velocity.z = 0
inventory_opened_in_air = false # Reset the flag once player lands

move_and_slide() # Apply gravity and handle movement
return

Expand Down
2 changes: 1 addition & 1 deletion player.dat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"GAME_STATE":"NORMAL","Health":72,"Position":{"x":-29.9095649719238,"y":24.386905670166,"z":20.3818187713623}}
{"GAME_STATE":"NORMAL","Health":72,"Position":{"x":-25.1203689575195,"y":24.3869037628174,"z":27.6839046478271}}

0 comments on commit 941d879

Please sign in to comment.