Unity Roll a Ball Implementation

Mar. 6, 2021

This post describes briefly how I implemented Roll a Ball in Unity, what difficulties I faced as a beginner and how I overcame them. Additionally in the end you can find some captures I took of the Unity screen and the game screen.

What is Rall a Ball ?

Roll a Ball is a minigame where the player controls a small ball and has to roll it to collect the most collectibles possible (which can take any form possible), hence the name. The player is, of course, bound in a space so he could not roll the ball outside the playing field. The player can move in any direction he wishes to.

Roll a Ball

That’s it, it is simple game, but is a great way to start learning about the Unity environment (as a developer). By going through the process of implementing the game, I learned a lot about how objects, assets, etc. were coordinated in the Unity environment ! It is a great way to start that I recommend.

References that helped me with the implementation

Following through with the tutorials in these references, it was fairly easy to implement the game, but I ran nonetheless into some challenges I will describe next.

Difficulties

All steps were easy until when I had to duplicate the collectibles. It was not hard creating the collectibles, but rather moving them around the scene to place them right (my choice was to place them in a circle). There was a little catch. I had to change the Toggle Tool - Gizmo - to Global (from local), so the object moves as I wish (parallel to the ground) when looking at it through the Y-Axis. I found this catch through Unity’s tutorial videos on youtube, specifically: https://www.youtube.com/watch?v=HlDGSStxuHI

No problems afterwards for scene reproduction.

Then came the time to build, run and test the game. The game built fine but I observed no movement when keys were pressed, as if the key press events were not taken into account. To resolve the problem, I had to recreate a new input actions file after writing the scripts, so the play button would appear on its icon (which was not apparent before for one reason or another) (see figure below). Input Action File

All worked fine after this last step and I was able to run and play the game !

Screen Captures

Capture 1 Capture 2 Capture 3 Capture 4 Capture 5 Capture 6