Meet Langston! He’s teamed up with instructor Dilan as part of Game-U’s New Jersey Accelerate program. Langston’s learning how to use Unity, a professional gaming engine, to develop his own gaming projects. Check out his twist on the classic matching game, Memory!
What makes a memory game? Langston kicked off his project by identifying key mechanics he needed to replicate in Unity. His game needs to generate random game boards, flip selected cards, detect matches, remove matched cards, and track player score. Langston decided on a bedroom background for the game board and collected sprites (images) to represent the game pieces, including a pillow graphic for the front of each “card,” and a cute animal graphic for the back. Langston created and placed card objects on the game board and coded a script that switches between the pillow and animal sprites whenever the gamer clicks an object. He also added a label object to hold the score text. By updating his score variable every time the game detects a match, Langston can code the gamer’s score to display at the bottom corner of the screen!
Once Langston finished laying the foundation of his game, he took on its more advanced features. Using the randomizers built into C#, the programming language, Langston created a script that shuffles his animal sprites each time the gamer loads a new board. Inside the script associated with the card objects, Langston added new code that checks visible animal sprites to see if they match. If the sprites match, the script adds one point to the score variable and removes those sprites from the board, leaving two empty card objects. If the sprites don’t match, the script switches from the animal sprites to the pillow sprite, creating the illusion that the cards flipped back to their original side. Langston’s code continues to respond to gamer clicks and match results until the gamer collects all the matches!
Great work on this project, Langston! You recreated a classic game in a digital environment and put code (and the Unity engine) to work for you. Thanks for sharing Memory Pillows with us, and keep building games! We look forward to hearing all about your next project.
Leave a Reply