Snowball Bat Attack [SOLVED]

Hi

I have a snowball bat that is supposed to fire snowballs at the enemy when I right click.
IT isn't firing however. I had it working sort of, where it would fire off two snowballs but now it isn't doing anything.

SnowBallBatObject

Code:
if (hp <= 0)
{
    instance_destroy();
}


if (hp <= 0)
{
    instance_destroy();
}



    if (flight == true)
    {
            if (point_distance(x, y, target_placement_x-100, target_placement_y-100) > 5)
            {
                sprite_index = SnowBatWalk;
                move_towards_point( target_placement_x-100, target_placement_y-100, 10 );   
                global.dropped_bat = false;
            }
            else
            {
                speed = 0;
                flight = false;
                sprite_index = SnowBatStill;
            }
        
        
    }
        else
    {
        
        alarm[2] = room_speed * 3;
    }


if (killed_a_brain == true)
{
    
    sprite_index = SnowBatStill;
    killed_a_brain = false;
    
}

//if (!under_attack && !flight && !colliding_flag)
//{//
//    sprite_index = SentryBatIdle ;   
//}


if (!instance_exists(global.current_collision_snow))
{
    if (flight)
    {
        sprite_index = SnowBatWalk;
    }
    else
    {
        sprite_index = SnowBatStill;
    }
}


        
    if (target_x > 0 && target_y > 0)
    {
    
    
    /*   
        if (global.current_bat == SnowBatObject)
        {
        
            global.current_bat = instance_create_depth(x, y, -10000, SnowballObject);   
            global.current_bat.target_x = target_x;
            global.current_bat.target_y = target_y;
            target_x = 0;
            target_y = 0;
        }*/
        
        
        //if object_index <--- object_index will always hold true
        //in the following condition because snowbat is the object_index
    
    if (mouse_check_button_pressed(mb_right))
    {
        with(global.current_bat)
        {
            
            if (global.current_bat.object_index == SnowBatObject)
            {
        
            //global.current_bat = instance_create_depth(x, y, -10000, SpitObject);   
        //    global.current_bat.target_x = target_x;
    //        global.current_bat.target_y = target_y;
            ////target_x = 0;
        //    target_y = 0;
                snow_inst = instance_create_depth(x+150, y+150, -10000, SnowballObject);
                snow_inst.target_x = target_x;
                snow_inst.target_y = target_y;
            
            }
        }
    }

        
}

/*test*/

if (mouse_check_button_pressed(mb_right))
{
    right_click = true;
    var inst;
    //inst = instance_place(mouse_x, mouse_y, BigBrainObject);
    //if inst != noone
    //{   
        target_x = mouse_x;
        target_y = mouse_y;
    //}
    sprite_index = SnowBatAttack;
    
    cell = instance_position(x,y,WhiteCellObject);
    if (cell != noone)
    {
        cell.occupied_flag = false;
    }
}

//
if (mouse_check_button_released(mb_right))
{
    right_click = false;
}

//is the bat moving? turning flight on activates movetopoint
//is this bat a new bat?










/*
if (mouse_check_button_pressed(mb_right))
{
    right_click = true;
    var inst;
    inst = instance_place(mouse_x, mouse_y, BigBrainObject);
    //if inst != noone
    //{   
        target_x = mouse_x;
        target_y = mouse_y;
    //}
    sprite_index = SnowBatAttack;
    alarm[0] = room_speed;
    alarm[1] = room_speed*30;
}
*/

This is the code for the snowball

Code:
    if distance_to_point(target_x,target_y) < 20
    {
            
        x = target_x;
        y = target_y;
        speed = 0;
    }
    
    move_towards_point( target_x, target_y, 20);
 
Top