so, im very new to coding, im doing a peggle style game and i wanted to make a score system that when i hit some balls each ball has its respective score and those points are added to a general points because its round based and if i reach certain points in that round i get an extra ball.
if someone could help me i would be very tankful idk what to type i need to say more things to post and idk how i can explain this with more detail it looks like a very simple thing to do
void Update() {
Ballcounter.text = Scriptholder.balls.ToString();
NewBall();
//if (ballcollision.roundpoints >= 750 && extraball = true)
// {
// Scriptholder.balls += 1;
// extraball = false;
// }
}
void NewBall()
{
if (Scriptholder.balls <= 2)
{
Ballcounter.color = Color.red;
}
else if (Scriptholder.balls >= 2)
{
Ballcounter.color = Color.green;
}
if (ballcollision.roundpoints == 0)
{
newBall[0].SetActive(true);
newBall[1].SetActive(false);
newBall[2].SetActive(false);
newBall[3].SetActive(false);
newBall[4].SetActive(false);
newBall[5].SetActive(false);
}
if (ballcollision.roundpoints >= 150)
{
newBall[0].SetActive(false);
newBall[1].SetActive(true);
newBall[2].SetActive(false);
newBall[3].SetActive(false);
newBall[4].SetActive(false);
newBall[5].SetActive(false);
}
if (ballcollision.roundpoints >= 300)
{
newBall[0].SetActive(false);
newBall[1].SetActive(false);
newBall[2].SetActive(true);
newBall[3].SetActive(false);
newBall[4].SetActive(false);
newBall[5].SetActive(false);
}
if (ballcollision.roundpoints >= 450)
{
newBall[0].SetActive(false);
newBall[1].SetActive(false);
newBall[2].SetActive(false);
newBall[3].SetActive(true);
newBall[4].SetActive(false);
newBall[5].SetActive(false);
}
if (ballcollision.roundpoints >= 600)
{
newBall[0].SetActive(false);
newBall[1].SetActive(false);
newBall[2].SetActive(false);
newBall[3].SetActive(false);
newBall[4].SetActive(true);
newBall[5].SetActive(false);
}
if (ballcollision.roundpoints >= 750)
{
newBall[0].SetActive(false);
newBall[1].SetActive(false);
newBall[2].SetActive(false);
newBall[3].SetActive(false);
newBall[4].SetActive(false);
newBall[5].SetActive(true);
Scriptholder.balls += 1;
}
}
//for the extra points
void Update()
{
Debug.Log(Health);
score.text = points.ToString();
roundPointsTXT.text = ballcollision.roundpoints.ToString();
points += ballcollision.roundpoints;