Time bonus

hey guy im trying to create a time bonus function in my game

the problem is when i try to add to my timer based on passing a score it multiplies by like a couple hundred :rage:

heres what a sample code would look like:

if(score == 2500)
{
   timecount += 10;
}

ive alos tried:

if(score == 2500)
{
   timecount = timecount += 10;
}

im using a simple invoke repeating method to wind down timer but before that i used another way to count down and it still acted in this manner.

It depends where you put that if clause. If it’s in the update it will keep adding time until the score no longer equals 2500. If you want to make sure it only does it once you can use a bool:
I’m not sure what language you are using but something like:

bool upgraded = false;

void Update(){
    if(score == 2500   !upgraded)
    {
       timecount += 10;
      upgraded = true;
    }
}

ahh nice man that worked perfectly i dont use bools to much but i see i need to start lol

question for ya

because i want to use more than once like, every 2500 points a time bonus is awarded but i dont necessarily want to write out like 30 of these and change the amount if i dont have to im thinking maybe a loop but dont know how to implement any recommendations?

bool upgraded = false;
int lastupgrade;

void Update(){

    if(score == (lastupgrade + 2500)   !upgraded)
    {
       timecount += 10;
       lastupgrade = score;
       upgraded = true;
    }else if(score > lastupgrade){
       upgraded = false;
    }

}

this should do the trick. Untested though.

does the job appreciate it sir!