Here we add a counter to keep track of how many game objects are collected and also display the text of the score and a message whenever the game is over.
Adding a Counter:
To display text, we go to the heirarchy create menu and click on UI --> Create and voila:
AHHHH, that is too big.
Like other objects, we want to reset the transform to origin. For the UI element, instead of a regular transform box, we see the Rect Transform. This is different as it has to do with anchoring and positioning.
Zoomed in:
Now if we want to change the position of the text from the center middle of the screen, we can click on the Anchor button and now get to select from a number of options. Here we select top + left after holding down Shift + Alt.
Original Anchoring
Changed To Show Text at Top Left Corner of Game Screen:
The last step was to add a Win Text message for when all the game objects are collected.
Here we just repeated the steps from above, except positioned it a little offset in the positive y direction from the player object.
Then you can build your game for an OS by clicking on the executable file.
Adding a Win Text:
Here we just repeated the steps from above, except positioned it a little offset in the positive y direction from the player object.
Building / Deploying the Game:
Then you can build your game for an OS by clicking on the executable file.
I was surprised with how easy it was to deploy for different operating systems. The default option was PC, Mac, and Linux Standalone.
They have options for mobile as well.
Here is the final game:
Completing this first tutorial was a lot of fun and has given me a lot of ideas on what I can include for my own game. Look out for the next tutorial review!







No comments:
Post a Comment