I am a programmer working with the free version of lite-c
In my game I want it to be that when my enemies have a collision my game over entity appears,
I am using the code below:
var g_over = 0;
function game_over()
{
if(event_type == EVENT_IMPACT | event_type == EVENT_ENTITY)
{
wait(1);
g_over = 1;
ent_remove(t_bod);
ent_remove(t_gun);
ent_remove(ship);
ent_create("invader_over.mdl", vector (1000, 50, 20), NULL); //create lose frame
}
}
action invader_attack()
{
var attack = 0;
set(my, PASSABLE);
while(my)
{
wait(-1);
}
}
action invader_one()
{
ship = me;
c_setminmax(me);
my.emask |= (ENABLE_ENTITY);
// my.event = frag;
while(my)
{
if (g_over == 1)
{
wait(1);
ent_remove(me);
}
my.pan += 0.7;
c_move (my, vector(imix, imiy, imiz), vector(imiax, imiay, imiaz), IGNORE_PASSABLE); // move the invader according to the ai action
wait(1);
}
}
action invader_two()
{
ship = me;
c_setminmax(me);
my.emask |= (ENABLE_ENTITY);
//my.event = frag;
while(my)
{
if (g_over == 1)
{
wait(1);
ent_remove(me);
}
my.pan += 0.7;
c_move (my, vector(imiix, imiy, imiz), vector(imiax, imiay, imiaz), IGNORE_PASSABLE); // move the invader according to the ai action
wait(1);
}
}
action invader_three()
{
ship = me;
c_setminmax(me);
my.emask |= (ENABLE_ENTITY);
// my.event = frag;
my.event = game_over;
while(my)
{
if (g_over == 1)
{
wait(1);
ent_remove(me);
}
my.pan += 0.7;
c_move (my, vector(imiiix, imiy, imiz), vector(imiax, imiay, imiaz), IGNORE_PASSABLE); // move the invader according to the ai action
wait(1);
}
}
When my invaders have a collision t_bod and t_gun disappear.
Then I get:
"Crash in invader_one" (the message pops up the amount of times equal to the remaining invaders running invader_one)
"Crash in invader_two" (the message pops up the amount of times equal to the remaining invaders running invader_two)
"Crash in invader_three" (the message pops up the amount of times equal to the remaining invaders running invader_three)
The weird part is if I repeatedly press ok then its good!
Please help
rtsgamer706