//fire primary weapon
action game_fire_primary()
{
e_bullet = ent_create("models\\bullet1.mdl", tank_turret.x, game_fire_bullet);
vec_set(e_bullet.pan, tank_turret.pan);
}
//bullet behaviour
action game_fire_bullet()
{
my.skill1 = 1;
while(my.skill1)
{
c_move(me, vector(0,40,0), nullvector, IGNORE_FLAG2);
game_bullet_collide();
wait(1);
}
wait(1);
ent_remove(me);
}
//bullet destruction
function game_bullet_collide()
{
if(event_type == EVENT_BLOCK || event_type == EVENT_ENTITY)
{
me.skill1 = 0;
draw_text("collision", settings.screen.x / 2, settings.screen.y /2, vector(255,0,0));
}
}