Make a working character selection menu?
I want my characters to cycle when pressing “A” or “D”, and depending on which value you are (what character is currently selected), it will send you to the next or either previous character.
For example, I have 3 characters in this occasion.
If I press “D” and the last (3rd) character is selected, go to the first
If I pres “A” and the first character is selected, go to the last (3rd)
It just ends up bugging. When I press “A” while in the first character, instead of going to the 3rd, I go to the 2nd. Same thing backwards: When I press “D” while in the 3rd character, instead of going to the first, I go to the 2nd. Here’s a gif, showing the problem in action:
Focus on the lower-left corner, that number is the “personagemSelecionado” variable.
The rest doesn’t really matter that much, only the sprites in the center that show which is the current selected character.
Just to clarify, “personagemSelecionado” meanst the current selected character, and “totalPersonagens” means the total amount of characters to select -1 (In this case, I have 3 characters, so the total amount is 2)
personagemSelecionado = Current selected character in the menu
totalPersonagens = 2