SelinaDev / Godot-Roguelike-Tutorial

Yet Another Roguelike Tutorial in Godot
MIT License
102 stars 11 forks source link

Bug with Fireball scrolls and input handlers. #5

Closed pkillthetoy closed 10 months ago

pkillthetoy commented 10 months ago

In part 9, dying to your own fireball scroll lets you move your corpse around afterward.

This is because the player will die and correctly transition to the GAME_OVER input handler via signal, but then as we exit the inventory menus, that will cause us to return to the MAIN_GAME input handler, overriding the GAME_OVER. I hacked together a fix by making the transition_to function do nothing if you're in GAME_OVER, and then added a force_transition_to function that skips that check, in case I need it later (for e.g. popping out to a main menu).

My own codebase diverges from the tutorial code in a few places, in particular inventory menu structure, but someone else reported this issue to me and I ran into it as well.

SelinaDev commented 10 months ago

Thank you for notifying me! This is indeed something I have overlooked. I mean I do have to admit that I am not really happy with how the input handling state machine turned out, specifically because it creates a lot of edge cases like this. Also thank you for suggesting a solution, I think I will implement that.