XRD Week 11

 Repository link: https://github.com/composer404/XRArcade

XRD Week 11 - Cards Game

During week 10 the card game was developed. The mini game is a memory game targeting people of all age groups. 

Main purpose behind the game is to find all matching cards in the card set. There are 9 types of fruits and each fruit card has its matching corresponding card and the player has to find it within 40 seconds to win. At the beginnning of the game cards are rotating so that the player can see all the cards and try to memorise their location, after that all of them turn back and game starts, player can pick two cards at once in order to see if they match. If the player picked unmatching cards, both will rotate back allowing the player to choose another set of cards that he thinks might be a match. The screenshot below represents cards at the beginning phase of the game - rotated for a short period of time allowing the user to memorise them before they rotate back and the player can test how well he memorised the cards.


Fruit cards

Card models

Card models were designed in blender and then imported to unity. In order to create the textures for each of the fruits photoshop was used to paint on UV map of the object.






Card components

Each card has a box collider and XR Simple interactable components which are allowing us to interact with the card, like pointing and rotating it.

Each card has an unique id and cards with the same fruits on them (matching ones) have the same ids.


 Applying ids lets us check the cards in order to know if the player pointed to the card with matching id.




Hover Entered and Exited

Interactable events of the XR Simple Interactable allowed us to add additional features like :
  •  on hover entered when a player points to the card it changes the material to a different one

  •  on hover exited the material of the card changes back to the one it was before




On hover


Checking for matching cards

Method below checks whether those 2 cards which the player has drew are matching cards or not.
If the cards are matching then their rotation is disabled allowing the user to see his progress and how many cards he has already guessed.

Matching cards method


If those 2 cards happen to have different ids therefore they are not maching, cards are rotating back.

Not matching cards method


On select entered

On select event method on click is triggered which rotates the card and enables the player to see the fruit on the card.


Card position

Thanks to this method called Shuffle, each time we start the game, cards are shuffled to different positions.



Cards are firstly shuffled and later their position is assigned.




Cards Rotation

Cards are rotating at the beginning to reveal the fruits location or whether the player clicks on them. To make the whole rotation process more smooth and visualy pleasing a unity mathematical function called lerp was used. What lerp does as for the rotation of the card is to ease the transition between two values over time, using some simple math.









Timer and winning/ losing screen

Depending on if the player succeded to find all the fruit card pairs before the timer hits 40 seconds, a winning or losing screen was added at the end of the game. Both scenes have the possibility to restart the game or go back to the main menu after finishing a game.








Author: Sandra Grzelak




Comments

Popular posts from this blog

XRD Week 10

Personal Reflections - Oliwer Szefer 293139