I am making a simple Tank game....
the user fires the main turret by clicking on the left mouse button. when this happens i call a function which creates the shell/bullet entity using ent_create and registers it as a physics entity and gives it an initial velocity. relevant code is given below:
if(mouse_left)
{
turret_fire();
}
function turret_fire()
{
turretfire_snd_handle = ent_playsound(my,turretfire_snd,900);
shell_handle = ent_create("shell.mdl",vector(200,0,20),shell_move);
phent_settype(shell_handle, PH_RIGID, PH_BOX);
phent_addvelcentral(shell_handle,vector(200,0,90));
}
till this point it works fine.....the shell is created and gets the velocity(200,0,90). now i want to detect any collisions that the shell makes. since shell_move is the action associated with the shell, i wrote this piece of code:
action shell_move()
{
my.enable_impact = ON;
my.event = shell_explode;
}
but the function shell_explode() NEVER gets called....even when i can see that the shell collides with another tank.
what am i doing wrong??.....this is the first game that i am making so i am sorry if the mistake is very obvious.....