link script FlickerWhenHit_Active
{
void run()
{
int frame = 0;
while(Link->HP > 0) //If Link was hurt by anything.
{
++frame; //frame 1 starts immediately.
//every game loop, frame will increase by '1', and will eventually roll over.
//do things base on the frame timer:
if ( frame&1 && Game->DCounter[CR_LIFE] ) //if the frame is odd
{
//flicker Link
Link->Invisible = true;
}
else //the frame is even
{
Link->Invisible = false;
}
if ( frame > 100000 ) //no need to constantly check
{
//reset to 1
frame = 1;
//now we won't roll over
}
Waitdraw();
Waitframe();
}
Link->Invisible = false; //clear this status if he is dying, and we'll run his onDeath script.
}
}
Comments