Monday, 23 November 2015

UI Card Game part 3

The final stage of the game, was the actual game mechanic itself. With the cards randomly shuffling upon starting the game, all I had to do was set the card backs to display as opposed to the front. I needed to set cards to flip upon being clicked and check if it matched the ID of the next card being flipped. If so then the cards needed to remain upright, otherwise flip them back.

To do this I needed a method in the card behaviour that passed the cards information to the game manager upon it being clicked. When two cards have been clicked and passed their information, a co-routine to compare the cards is started. If the two cards match, the tally for pairs needed to win increased, bringing the player one step closer to finishing and they then remain unclickable. If they don't match, both cards are flipped back and made clickable again.
Card game partway through

The final thing to do was provide a win screen when the player matched every card. This was easily done by checking if the pair tally equaled 8 or not. If so then a delegate message is sent to display the win overlay image and I even added music to make it more of a celebration.
Finished game with win display

No comments:

Post a Comment