C # timer [duplicate]

0

I'm programming the screen of a game where it will show the score of the player in progressive mode, it shows the score at the end of the match but does not show with the effect of time between the numbers. my while is wrong?

int n = 0;
while (n < sPontuação) 
{
    n++;
}
Console.WriteLine("", n);
    
asked by anonymous 21.07.2017 / 15:58

1 answer

3

Your while is correct, however to give this counting effect missing use the System.Threading method; which is a timer for running in milliseconds.

Make this change in the while:

int n = 0;
while (n < sPontuação) 
{
    n++;
    System.Threading.Thread.Sleep(3000)
}
Console.WriteLine("", n);
    
21.07.2017 / 16:00