Goal
Our creation
Our ball is now moving, we can focus ourself on the camera , we want our camera to follow the player:
It's time to add our collectibles I decide to write TSP and INT which are acronym of my school. I also add a little script to them "transform.Rotate(new Vector3(0, 90, 90) * Time.deltaTime);" in update function to make them rotate.
I complete PlayerController with an OnTriggerEnter() function, to make Collectibles dissapeared when player touch it. Tag is important otherwise without if-condition other objects could disappear.
Last thing is to add an UI (User Interface) to display score and an end message. You could check on PlayerController how it works in detail using TMPRO library. Just check what appeared in PlayerController, all functionalities without UI are above.
Now our game is finished we can build it. Go to Files > Build Settings. Select the scenes “Scenes/roll-a-ball” then open Player Settings. Here we make this game windowed (it’s better for a game without menu).
Roll-a-ball.exe
can be played on every PC, Mac & Linux Platform, you can try it on my github (version for mobile too).