i want my game to add a point for every time you cross a line like in the game dune but i dont know how to make 1 go to 2. every time the player is above the line its just adds like 20 more 1’s.
heres the code for it
// Update is called once per frame
void Update()
{
if (Player.position.y > -0.05)
{
scoreText.text += 1;
}
}
}
You can use Vector2.Distance from th starting point of your game @LBernard1431 .
the starting point is the starting point of your reader: normally 0.
The addPoint variable will increase the value of range, it’s up to you to adjust it according to your needs.
float range = 0;
[SerializeField] float additionPoint = 10f;
public Vector2 startingPoint;
private void Update()
{
range = Vector2.Distance(startingPoint, transform.position) * additionPoint;
}