Code:
function player_action
{
player = me;
my.gravity = 3;
my.shadow = on;
player.health = 100;
my.enable_impact = on; // and make it sensitive to enemy bullets
my.enable_entity = on; // and to other entities
my.push = -1; // shouldn't be able to pass through walls (push = 0)
my.event =decrease_health();
changeto_level = 0;
player_weapon=ent_create("hkusp.MDL",my.x,attach_weapon_char2);
p1_handgun=1;
my.skill46 = 0;
state=1;
wait(1);
if(my.health<=0)
{
my.blendframe = death;
IF(p1_meelee==1){ handle_char1_animation();}
IF(p1_handgun != 0){ handle_char2_animation();}
IF(p1_rifle!=0){ handle_char3_animation();}
IF(p1_rifle==0&&p1_handgun==0&&p1_meelee==0){ handle_char4_animation();}
ent_remove(player);
// exit();
}
WHILE (player.health > 0)
{
.........//player movement
------------------------------------------------------------------------------
//enemy shoot bullet
function move_bullet()
{
my.skill47 = 5; // that's an enemy bullet
my.pan = you.pan; // the bullet and the enemy have the same pan angle
my.push = -1; // passes through enemies, hurts the player
my.enable_entity = on; // the bullet is sensitive to other entities
my.enable_impact = on;
my.enable_block = on; // and to level blocks
my.event = remove_bullet;
while (my != null)
{
bullet_speed.x = 150*time;
bullet_speed.y = 0;
bullet_speed.z = 0;
move_mode = ignore_you + ignore_passable + ignore_push; // ignores the enemy (its creator = you)
c_move (my, bullet_speed, nullvector, ignore_you);
// ent_move(my.skill1, nullvector);
wait (1);
}
}
-------------------------------------------------------------------------------
function decrease_health()
{
if(my.skill47==5)
{
player.health -= 50; // loose 50 health point every tick
}
if (my.health <= 0)
{
my.event = null;
snd_play (death_wav, 40, 0);
my.z -= 30; // set a lower height for the player
camera.roll = 30; // and a weird roll angle
ent_remove(player);
}
}
how come my player life wont reduce, he cant die?
can anyone can help me with that?
thx in advance