if( state == "hide")
{
if(distance_to_object(objLink) < 48 && distance_to_object(objLink) >= 16)
{
state = "jump";
sprite_index = sprite12;
image_speed = 0.5;
image_index = 0;
}
}
else if( state == "jump")
{
if (image_index == 5)
{
state = "idle";
sprite_index = sproctorok;
image_speed = 0.4;
image_index = 0;
}
}
else if( state == "idle")
{
//condition to go back to hiding following dive
if(distance_to_object(objLink) >= 48 && distance_to_object(objLink) < 16)
{
state = "dive";
sprite_index = sprOctDive; // or whatever sprite you use for diving
image_speed = 0.5;
image_index = 0;
}
//condition to go to shooting
else if( shootTimer > shootLimit ) // This you have to change to whatever you use
{
state = "shoot";
sprite_index = sprOctShoot; //or whatever sprite you use.
image_speed = 0.5;
image_index = 0;
}
}
else if( state == "shoot")
{
//condition for going back to idle
if( image_index == ?? )
{
state = "idle";
sprite_index = sproctorok;
image_speed = 0.4;
image_index = 0;
}
}
else if( state == "dive")
{
//condition for going to hide
if(image_index == 5)
{
state = "hide";
sprite_index = sprite13;
image_speed = 0;
image_index = 0;
}
}
else
{
//you are in an error state best to resolve this
... throw message
//OR
... set to hide state
state = "hide";
sprite_index = sprite13;
image_speed = 0;
image_index = 0;
}