|
how can i make a point system, so that when a Gameobject of a particular Tag is destroyed, the points go up??
(comments are locked)
|
|
Keeping score is simply a case of incrementing the value of a variable when the player does something that will earn them points. To show the score on screen you can use either a guiText or something like a guilabel:
In the case of the guiText you would need to convert the value of the score (which is an integer) to a string, like so:
To increment the value of the currentScore variable, you could use something like the following. This is a modified extract from the Unity Game Development Essentials book where the player collects batteries by walking over them: Thank you very much! I keep forgetting to use .ToString()! But you reminded me and resolved my issue without me having to ask a question on here! Thanks a ton.
Jun 18 '10 at 01:31 AM
xToxicInferno
(comments are locked)
|
|
The best way is to notify another GameObject that keeps track of the score i.e. the player or a control GO. Something like this: Wow, so many answers for such a simple question
May 08 '10 at 04:44 PM
spinaljack
(comments are locked)
|
|
This page explains how to do scoring well. It is about the 4th item down. To determined if points should be added, add points from the death of the enemy instead of the player. So the player attacks the enemy. The enemy calculates the damage and determines it should die. It calls the Die method.
(comments are locked)
|
