I have an array with numbers. Each number resembles a card in a deck. A deck in my game can have multiple copies of the same card.
Now I have finally made an album in which the player can view all their unlocked cards. However, if a player has a lot of doubles, they see the unlocked card multiple times in the album.
This does not matter for developing. The album just shows 8 cards at the time and then the player can choose to see the next 8, or the previous 8. This loops till the end of the array is reached.
But for the player, it is probably a pain in the neck to see all those double cards. It bothers me during testplay, so it might bother my players as well.
So, I want to use a clone of the array containing their unlocked cards, and then take all the doubles out. I already did everything as planned, accept for that last step.
How do I remove all doubles from an array?
The array is sorted in numeric order, so doubles are right next to each-other, if that helps.
Now I have finally made an album in which the player can view all their unlocked cards. However, if a player has a lot of doubles, they see the unlocked card multiple times in the album.
This does not matter for developing. The album just shows 8 cards at the time and then the player can choose to see the next 8, or the previous 8. This loops till the end of the array is reached.
But for the player, it is probably a pain in the neck to see all those double cards. It bothers me during testplay, so it might bother my players as well.
So, I want to use a clone of the array containing their unlocked cards, and then take all the doubles out. I already did everything as planned, accept for that last step.
How do I remove all doubles from an array?
The array is sorted in numeric order, so doubles are right next to each-other, if that helps.