Timers
int timerMaxValue = 10;
int timerCurrentValue = 10;
while (true)
{
timerCurrentValue--;
if (timerCurrentValue <= 0)
{
Console.WriteLine("Tenth!");
timerCurrentValue = timerMaxValue;
}
}float timerMaxValue = 1;
float timerCurrentValue = timerMaxValue;
while (!Raylib.WindowShouldClose())
{
timerCurrentValue -= Raylib.GetFrameTime();
if (timerCurrentValue < 0 && Raylib.IsKeyDown(KeyboardKey.KEY_SPACE))
{
// Gör någonting, t.ex. skjut ett skott (varje sekund)
timerCurrentValue = timerMaxValue;
}
Raylib.BeginDrawing();
Raylib.EndDrawing();
}Last updated