Page 1 of 1

When player hit - becomes invincible for a second?

PostPosted: Wed Apr 18, 2007 12:30 am
by d-soldier
I've been trying to figure out (from the 1942 demo) how to go about making my player invincible (and flashing transparent) for a moment after he's hit by an enemy... but with no luck... Anyone want to take the time to help me with this?

PostPosted: Wed Apr 18, 2007 1:37 am
by Sgt. Sparky
make a variable called hit.
and a variable called wait
when he is hurt,
Code: Select all
if(hit == 0)
{
 hit = 1;
 do_damage calculation;
}
wait = 30;
//or whatever you want it to be,
//if you're game runs at 30 fps set wait to the fps rate(30) for a 1
//1 second wait time

on draw actor event:
Code: Select all
if(hit == 1)transp = .5;
if(hit == 0)transp = 0;
wait -= 1;
if(wait <= 0)hit = 0;

that should work :D
if you have any problems let me know. :)

PostPosted: Wed Apr 18, 2007 1:47 am
by d-soldier
Whats that "do_damage calculation;" for!?!
Haha, nevermind... figured it out!! :lol: Thanks for taking the time to spell it out for me, been racking my brain over that one for awhile now!

PostPosted: Wed Apr 18, 2007 2:15 am
by Sgt. Sparky
:D
welcome,
I used to do alot of playin' around with GE just to see what does what till I got the hang of it. :D
just let me know if you need help. :)