Re: Do you need tutorials ?
Posted: Sun Jan 16, 2022 4:16 am
I want create a timer event when countdown is 0 do something i dont know how use this
Sega Megadrive/Genesis development
https://gendev.spritesmind.net/forum/
https://gendev.spritesmind.net/forum/viewtopic.php?f=19&t=1618
Code: Select all
if (animationTimer > 59){
animationTimer = 0;
}
else{
animationTimer++;
}
}
Code: Select all
void myFunction(u8 *animationTimer, u8 *functionState){
switch(*functionState)){
case functionReady:
*animationTimer = 0; //Prepare Timer
*functionState = functionDoStuff; //Advance case.
case functionDoStuff:
int timerEventVaue = 15;
if (*animationTimer > timerEventValue){
*animationTimer = 0;
//Do Stuff
*functionState = functionReady; //Reset the case.
}
break;
}
}