Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Behold even more!

So the core code functionality is done for the tarot draw. It was…way easier than I actually expected it to be. I know the gif is fairly low quality, so I’ll drop a screenshot of the game manager here in a second, I just want to point out that when the cards on the table are updated every time a new draw is made. Now obviously this isn’t how it’ll function in game, I just wanted to make it clear that the link is there.

Hookay so, this is the manager:

We have a list that stores all of the Tarot card scriptable objects, three SO variables to hold the selected cards for the spread, and then the actual card meshes in the scene. 

How it works:

Currently this all runs off of the Draw Cards button in the Game Manager. 

  • When the button is pressed, a method is run to select three random numbers between 0 and 78 (the number of cards in a Tarot deck). 
  • I then test those three numbers against each other to make sure that there isn’t a duplicate among them. This is done with a do while loop. 
  • I then shuffle the Tarot card list using the Fischer Yates Shuffle algorithm, and if you haven’t heard of that before don’t worry, I was in the same boat. But Googling is a mandatory skill and luckily someone on Unity answers actually had a code snippet ready to go: https://answers.unity.com/questions/486626/how-can-i-shuffle-alist.html
  • Cards now properly shuffled, I assign each of the SO variables one of the cards from the list using the random numbers I generated as the list index.
  • Cards now selected, I assign the SO’s image to the material assigned to the card meshes.

All in 73 lines of code! Obviously there will be more once I hook this functionality up into a final system, but I was really surprised by how little it took to draw those cards out.

So tomorrow, I’m going back to some animation work. I need to get those finished so I can finalize the flow. The fortune teller needs a shuffle animation, as well as a deck holding idle. Once that’s done, there are a few more loose threads here and there, but the main thing will be the dialogue boxes!

I will refrain from making estimations on timelines, as that’s bad luck. But I will say that I’m feeling very good about the progress on this project. And oh it felt so nice to program again.