Example of Problem
The solution that I came up with to fix this problem was changing how our game states were handled. Instead of deleting and recreating the same level whenever we entered the shop, I coded it so that the game states existed simultaneously. By creating both the level and the shop simultaneously the player was able to enter the shop without wiping away their current progress. A minor problem arose since both of them existed simultaneously and the shop was overlapping the level and not allowing the player to actually play the game. That was fixed by altering the "Visible" variable included with the game state and making the shop not visible to the players. Then when it was necessary to enter the shop all that needed to be done was change the variables so that the shop became the visible layer and the game level became invisible; then once the player is done it is simple to reverse the process and leave them right where they left off.
Example After Fixing Code
No comments:
Post a Comment