Flashing Sprites.

You must understand the Game Editor concepts, before post here.

Flashing Sprites.

Postby Hblade » Sat May 16, 2009 6:37 am

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.
Attachments
flashdemo.zip
(45.95 KiB) Downloaded 155 times
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Flashing Sprites.

Postby jimmynewguy » Sun May 17, 2009 3:52 am

that's pretty helpfull, too bad i have my own way of showing how enemies get hurt.....i would have used this :)
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Re: Flashing Sprites.

Postby BlarghNRawr » Sun May 17, 2009 7:20 pm

+1
Download Game Music
current projects:
Bold! ?% Started mechanics
Unnamed puzzle game 60% --i need a name!--
User avatar
BlarghNRawr
 
Posts: 767
Joined: Wed Jun 25, 2008 12:36 am
Location: Not using G-E anymore. Now using Source SDK.
Score: 27 Give a positive score

Re: Flashing Sprites.

Postby Hblade » Sun May 17, 2009 7:46 pm

BlarghNRawr wrote:+1

+ 1 for you :D.
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest