Posted May 29, 2024 by Tapped Card Productions
In our latest build, we developed a comprehensive health system that allows both the player and the enemy to take damage, with win or lose conditions defining the end of a match. During development, we encountered an issue related to cursor interaction with the gameboard, particularly when the player clicks on the deck to draw a card and add it to their hand. The problem was that the cursor would revert to the default system cursor when it hovered over the deck and would not change back to the custom cursor unless the build was restarted.
This issue arose because the script responsible for changing the cursor did not consistently maintain the custom cursor state when interacting with certain game objects. When the cursor entered or exited specific elements, it was not properly resetting to the custom sprite, leading to unexpected behavior and a jarring user experience.
To resolve this, we took the following steps to ensure that the custom cursor persisted reliably:
OnMouseOver
method to continuously check and enforce the custom cursor. This method ensures that if the cursor is not the custom sprite, it gets reset to the custom sprite.OnMouseEnter
and OnMouseExit
methods to ensure that the custom cursor is set correctly when the mouse enters a relevant object and reverts back to default only when necessary.Implementing these changes significantly enhanced the user experience by providing a consistent and responsive cursor interaction:
Overall, the changes led to a smoother and more enjoyable gameplay experience. The cursor behavior now aligns with player expectations, ensuring that interactions with the gameboard and deck are intuitive and seamless. This improvement highlights the importance of polished UI interactions in enhancing the overall quality of the game.