Scripting a Score

For the past few days, I have been presented with the challenge of scripting a “score”, which would count the amount of orbs you collect and for it to be constantly present on the GUI.

Being a complete beginner, I started off with reading a few books on the coding language of C#. so that I would be able to follow tutorials a lot easier and hopefully be able to read lines of code and roughly understand what is happening.

Following that I started to look up tutorials, however, they weren’t all that useful because the code would not fit the context of my game. So I had to adapt lines of code, so that it would work with my game.

The following is the script that I added onto my FPC.

Screen Shot 2018-11-11 at 16.20.59.png

This script would then allow my FPC to collide with certain game objects and to count them, whilst updating the count text. When a collision is detected, the collided game object will de-activate. After reaching a certain amount of orbs, the win text will then appear on the GUI.

Screen Shot 2018-11-15 at 16.15.30.png