4ColorMatch Game | Color Matching Game - Unity Game Development

in #utopian-io5 years ago

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

Sort:  

Thank you for your contribution. Nice game!

  1. A class should hold single responsibility. For example, the Ball class should not deal with GameOver logics - instead, this should be moved to Game engine.
  2. The public class attributes could be better turned into getters and setters e.g. { get; set; }
  3. I feel like there are no local variables and some are not necessary defined as class attributes, such as objNum

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Chat with us on Discord.

[utopian-moderator]

Thank you for the suggestion @justyy

Thank you for your review, @justyy! Keep up the good work!

Hi @praful!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Hey, @praful!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Coin Marketplace

STEEM 0.30
TRX 0.12
JST 0.033
BTC 64222.08
ETH 3135.29
USDT 1.00
SBD 3.99