- Home /
How do I shuffle a list and reset it back to the previous ordering later?
Hi,
for my current card-game project I use Lists<> of my Card-class for the decks. One of the card effects lets the player select cards from his deck and increase their power. During that process, I would like the cards to be in random order so that the player cannot see their actual order inside the deck. Shuffling the cards is no problem, but how can I store their order so that the actual deck doesn't shuffle? I tried making a copy of the decklist but that way the changes to the cards won't save since I change a copy and not the real card.
Thanks in advance, any help is appreciated!
Answer by ShadyProductions · Jul 14, 2020 at 01:13 PM
Make a copy of the list, shuffle that copy and represent that copy list. Then when the copy card is selected, you find the real card out of the real list based on the copy, shouldn't be hard since its a literal copy and then apply the changes on that real card?
Thank you, it works fine now! Sometimes the solution is not as complicated as you might think.
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Random Tag Call Script [C#] 3 Answers
Random Shuffle Listing 2 Answers
Shuffle a deck for a card game 1 Answer
List woes. (C#) 1 Answer