I've been staring at this code and wondering why it doesn't work for too long. It is a bullet and when it hits an object, it should remove itself. But the collision event isn't been triggered, even though it is the same emask as my missile function, which does work.
function bEvent()
{
if(event_type == EVENT_BLOCK)
{
beep();
my.event = NULL;
my.health -= 1000;
}
}
action bullet()
{
my.health = 1;
set(my,FLAG2);
my.emask |= (ENABLE_BLOCK | ENABLE_ENTITY);
my.event = bEvent;
my.pan = turret.pan;
my.tilt = 0;
my.roll = 0;
my.z = turret.z;
while((vec_dist(my.x,player.x) < 2000) && (my.health > 0))
{
c_move(my,vector(125 * time_step,0,0),nullvector,IGNORE_FLAG2 | IGNORE_PASSABLE | IGNORE_SPRITES | ACTIVATE_SHOOT);
wait(1);
}
ent_remove(me);
}
The issue is, when it hits a block, it does not beep. (and no, my sound isn't muted.)