Monday, February 20, 2017

Day 13: Displaying Score and Text

To make the game 'count' how many objects have been picked up, I needed to add another variable to the Player Controller script. The script I added has a green description next to each part of it.

Now, to display text, I needed to create a new text object.

The script that I then added creates a variable called "CountText", and it is set equal to the Count variable every time a object is picked up.

Now, to connect the text object to the script, I simply dragged it into the  "Count Text" slot in the inspector.

It works.

To make the "You win!" text at the end, I first created a new text element, same as last time. I named in "Win Text" (not shown).

Now, to display the text, I added a new variable...
And added some code to display the text "You Win!".
And it works!

Next class I will "Build the game and deploy it using a standalone player". In other words, it will be an independent game from the Unity game engine.



No comments:

Post a Comment