Find number game tutorial (Part 2)

Part 3: Background and End game sprite

1.           1. Drag and drop Background Prefab  from Folder Prefabs to Hierarchy


            2. In the Hierarchy, we will create a new EmptyGameObject and rename as Finish. Then, we click into setting icon and reset( reset location of Finish)

       3. Right Click to Finish GameObject , we will create a new GameObject. This is child of 2D Object. Then, we click into Sprite and rename as Victory. In the Sprite Renderer Component, we use Cycle-select button to set Victory for Sprite. In the Transform, set up as Position (4,0,0), Rotation (0,0,90), Scale (0.5,0.5,1). 


4.           4. Similarly, we create the 2D Object> Sprite and rename as Defeat. In the Sprite Renderer Component, we will use Cycle-select button to set defeat for Sprite. In the Transform, coordinates are Position (-4,0,0), Rotation (0,0,-90), Scale (,1).

5. Drag Finish to Folder Prefabs

6. In the Hierarchy, Delete Finish

7. Save scene

Part 4: GameManager

1. We will create an Empty GamObject, its name as GameManager

2. In the Scripts Folder, Drag and drop the MakeGame.cs to GameManager

3. In the Make GameCompoment, Drag Number and Finish Prefabs in the Folder Prefabs  to Num

4. Set Color cho Player 1 là #1abc9c, Player 2 là #e67e22, Final Color là #9b59b6

    (We should consult other flat colors at )

5. Save scene

Part 5: Script


In the Part, we will know what we will do in MakeGame.

       We will create an Array including 50 elements which have determined location and a random deviation compared to create the natural of the figure position. 


       In this code, we will create random position of figures ( from 1 to 50) and instantiate at Desktop Screen




       This is the process of handling touch events on mobile screens when a player touches the correct number, it will be marked in table 2 (left and right)


        At the end of Game, screen will display who is the winner.

   We will continue with Part 3 - the last part - how to make find number game.