Hello, I've got a logic problem that's causing me to scratch my head but I'm not sure what exactly I would need to do to solve it. In my game the player can obtain upgrades to their arsenal that are the same weapon type (dual pistols, multiple shotguns, and so on). I'd like it if I could combine the weapon select buttons so that the player doesn't have to reach across their keyboard to switch. For example:
Press 3 once, your character pulls out the single shotgun.
Press 3 with the single shotgun out, your character pulls out the double barrel.
Press 3 with the double barrel out, your character pulls out the automatic shotgun.
I've tried to emulate it here:
But obviously this doesn't work because the 'else' statement causes weapon 5 to never be selected. What would the proper way of coding this be?