Repository : https://github.com/prafulRb/4ColorMatch
About This Game
In this game, the objective is to match the color of the falling ball with the same colored side of the rectangle. Ball will have random color between red, green, blue and yellow and it will spawn randomly between three different positions, one at a time. Each rectangle has four colored sides. Player can rotate any of the three colorful rectangle by tapping on it. By rotating the rectangle, player can make ball land on the same color and gain score. As player gets more score the ball will spawn frequently increasing the difficulty of the game.
Technology Stack
This game is made using Unity 3d Game engine. C# language is used for programming. To open the github project you need to have unity installed.
Implementation of Some Parts
Input Controller
The rectangle is made of 4 triangle colored red, green, blue and yellow. Those triangle are child of the main rectangle. When player clicks the mouse the raycast is hit from the camera to the mouse position and checks whether it has hit any of those colored triangle and if it has hit then it will rotate its parent rectangle 90 degree by starting coroutine “RotateObject”.
Animate the rotation of rectangle
To animate the object, coroutine "RotateObject" is started. Inside the coroutine it checks if its current rotation is less than the final target rotation, if its less then it will rotate the angle a little according to the speed and then again coroutine “RotateObject” is started. So the coroutine will be called until the object current rotation reaches the final destination. Hence the object rotates 90 degree per click.
Spawning of the Ball
When ball spawns it will have random color and it will spawn at random position. The ball is spawned between certain interval and as time goes the interval between the spawning decreases to minSpawnTime.
Camera Shake Animation
For the camera shake animation I have animated the key frame position of camera form the animation window and triggered it when the player dies.
Future Implementation
The graphics will be improved and the game will be a lot polished for example, when the ball lands on the wrong color the ball will explode into small pieces, when ball lands on the same color there will be some particles effects and so on . I am also thinking of adding different game modes for example in one mode instead of single color ball, ball will have three different color out of four and one missing color and the player needs to find the missing color and land ball on that color side of rectangle.
Download and play the game
https://github.com/prafulRb/4ColorMatch/releases
Repository : https://github.com/prafulRb/4ColorMatch
Github Account: https://github.com/prafulRb