I was planning on making a point system for my car game… my car is called (“Car”) and i wanted it so when my care runs into a sphere (called “Point”) the person gets a point… alos i want a GUI text in the game that displays how many points… any one know a script that will help
1 Answer
1It’s simple enough. Have a value on your car that stores the number of points and adds the value of the Point object to it’s value. Ex:
Car
{
int score;
void OnTriggerEnter(Collision other)
{
Point point = other.GetComponent<Point>();
if (point != null)
score += point.value;
}
}
Point
{
public int value = 1;
}
It could be a lot more sophisticated, but this gives you a basic framework to at least add points to your car.
@iwaldrop do i add this script to the car or what
– jokerjosh15