/// @description 

if (global.game_state != GAME_STATE.GAME) {
	alarm[0]++;
	alarm[1]++;
	exit;
}

if (alarm[0] == -1) {
	var _near = instance_nearest(x, y, obj_entity);
	if (_near != noone) {
		x_shot = _near.x;
		y_shot = _near.y;
		if (point_distance(x, y, x_shot, y_shot) < range) {
			dir = point_direction(x, y, x_shot, y_shot);
			image_index = dir div (360 / image_number);
			
			switch(bullet_type) {
			case "ice":
				_near.alarm[0] = min(_near.alarm[0]+damage, 50);
				_near.alarm[1] = damage*3;
				break;
			case "rocket":
				instance_create_layer(x_shot, y_shot, "Parts", obj_ef_explosion);
			default:
				with(_near)
					sc_enemy_hit(other.damage);
			}
			alarm[1] = min((damage+cooldown) / 8, 8);
		}
	}
	alarm[0] = cooldown;
}