So I had to implement a reward screen where the player gets to choose a reward after completing the level. I created a button that would get a random item from an array when pressed and that item is then removed from the array. When there were no more items in the array then the button would be disabled. The problem I ran into was, after selecting either weapon for the first time the other weapon's button would be disabled. Meaning that the array was empty, and this would only happen with the weapons and not the other 2 buttons.
This obviously wasn't the right behavior, so the solution I came up with was just re-saving all the arrays when selecting a weapon. After that I had no more problems with buttons disabling before they should have.
Did you like this post? Tell us
Leave a comment
Log in with your itch.io account to leave a comment.