I am trying to make a Snake game. And what I want to happen is that each time the snake eats a piece of food it moves quicker.
I want to do this by making the timer tick faster.
I start the timer at an interval time of:
gltimer.Interval = new TimeSpan(20000)
And update it with:
public void updateTimer(object sender, EventArgs e)
{
long nrTicks = gltimer.Interval.Ticks;
nrTicks = (long)(nrTicks * 0.95);
gltimer.Interval = new TimeSpan(nrTicks);
}
But when I run my game the speed stays the same until I reach the 14th snack and then it suddenly changes. I already figured out that the nrTicks then drops below 10000.
My question is why the Interval doesn't update for the intermediate values?