How do I add a score system?
I would like to add a score system so when my player kills the enemies it will add points. Help me please.
Do you really think you are the first one asking this kind of question ? How is the community supposed to help with this few information ?
Answer by mcarvalho4467 · Apr 11, 2017 at 04:14 PM
you can find it here: https://unity3d.com/learn/tutorials/projects/survival-shooter-tutorial/scoring-points?playlist=17144
what is not working? post here what you have done
Here's the Enemy Health -
using System.Collections;
using UnityEngine;
public class EnemyHealth$$anonymous$$anager : $$anonymous$$onoBehaviour {
public int $$anonymous$$axHealth;
public int CurrentHealth;
public int scoreValue = 10;
// Use this for initialization
void Start()
{
CurrentHealth = $$anonymous$$axHealth;
}
// Update is called once per frame
void Update()
{
if (CurrentHealth <= 0)
{
Destroy(gameObject);
}
}
public void HurtEnemy(int damageToGive)
{
CurrentHealth -= damageToGive;
}
public void Set$$anonymous$$axHealth()
{
CurrentHealth = $$anonymous$$axHealth;
}
public void Scoring()
{
Score$$anonymous$$anager.score += scoreValue;
}
}
Here's the Score$$anonymous$$anger - using UnityEngine; using UnityEngine.UI; using System.Collections;
public class Score$$anonymous$$anager : $$anonymous$$onoBehaviour
{
public static int score;
Text text;
void Awake()
{
text = GetComponent<Text>();
score = 0;
}
void Update()
{
text.text = "Score: " + score;
}
}
Follow this Question
Related Questions
How do I make the Score system work? 1 Answer
Problem with counting score in 3D game 1 Answer
Problem with ScoreBoard in Ping Pong game 1 Answer
How do I make a score system? 1 Answer
Scoring different amount of points 0 Answers