Page 1 of 1

Flashing Sprites.

PostPosted: Sat May 16, 2009 6:37 am
by Hblade
I made another function. You can make your sprites flash when they get hit with this. Put this in Global Code.
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.

Re: Flashing Sprites.

PostPosted: Sun May 17, 2009 3:52 am
by jimmynewguy
that's pretty helpfull, too bad i have my own way of showing how enemies get hurt.....i would have used this :)

Re: Flashing Sprites.

PostPosted: Sun May 17, 2009 7:20 pm
by BlarghNRawr
+1

Re: Flashing Sprites.

PostPosted: Sun May 17, 2009 7:46 pm
by Hblade
BlarghNRawr wrote:+1

+ 1 for you :D.