For this tutorial, we will create a simple arcade style mini-game in Unity. This whole game only requires one script. This script will control everything from collisions to scoring and game over. This mini-game is a simple timing game that is based on a real arcade game that I saw in a YouTube short.
To get started we will create all the visuals and because this game is so simple and 2D we will create all of them with UI game objects. When we are done your game should look like this.
Your hierarchy should look like this.
The panel object is for our blue background. then the play zone is for the black circle. or the white circle. If you do the white circle first then you just want the white circle to be bigger than the black circle on top. If you do the black circle first then you will need to have white ring spite.
Next, we will create the coin object. This object will need a pivot which is an empty game object that we set in the middle of the play zone. We then need to offset the actual coin object. For the coin object, we will need to add a circle collider 2D and mark it as is trigger.
Behind the coin object, we will need to have a high-light object. This is an object that needs a faded circle sprite. This object should be disabled so we can enable it at the right time.
Next, we will create the line object. This object should extend from the center of the play zone and reach the outside of the circle play zone. This object will need a box collider 2D and a rigidbody 2D.
Finally, we will need a UI button that we archer to all corners so it overlaps the whole screen. We will also make it transparent.
Next, we will create the script for our game. This script should set the starting rotations to be random. In update, it will rotate the line if play is true. Then we will need on trigger enter and exit 2D functions that will control if the play can click the button and get a point or cause a game over. Finally, we will need a function that we can pair to our button. If click and the line is over top of the coin we will give a point. if not we will cause a game over.