Flashing Sprites.

I made another function. You can make your sprites flash when they get hit with this. Put this in Global Code.
now, in Draw_Actor, type FlashTransparrent(4, 49);. The 4 is the speed of the flashing. The 49 is how long you wan't it to be flashing. You can change numbers to set your right speed. Now, when you want to make your object flash, turn it on by typing flashon = 1;. When you wan't the character to stop flashing, turn it off. I'm going to add a delay count on it. That way you can set the amount of times you wan't your character to flash. Heres a demo.
- Code: Select all
int dpower;
int dframestart;
int flashon;
int flashstop;
int count;
void FlashTransparrent(int dframestartd, int ammount)
{
if (count == ammount)
{
flashon = 0;
transp = 0;
}
count = count + 1;
if (flashon == 1)
{
if (dframestart != dframestartd && dpower == 0)
{
dframestart = dframestart + 1;
}
if (dframestart == dframestartd)
{
dpower = 1;
}
if (dpower == 1)
{
dframestart = dframestart - 1;
}
if (dpower == 0)
{
transp = 0;
}
if (dpower == 1)
{
transp = 1;
}
if (dframestart == 0)
{
dpower = 0;
}
}
}
now, in Draw_Actor, type FlashTransparrent(4, 49);. The 4 is the speed of the flashing. The 49 is how long you wan't it to be flashing. You can change numbers to set your right speed. Now, when you want to make your object flash, turn it on by typing flashon = 1;. When you wan't the character to stop flashing, turn it off. I'm going to add a delay count on it. That way you can set the amount of times you wan't your character to flash. Heres a demo.