var walksprite = sprPWalkPistol;
var attacksprite = sprPAttackPistol;
var turnsprite = sprPPistolFlip;
if ( sprite_index == walksprite || sprite_index == attacksprite || sprite_index == turnsprite )
{
if ( sprite_index == turnsprite )
{
image_speed = 0;
isturning = true;
if ( turnwait > 0 )
turnwait = max( 0, turnwait - 1 );
else
{
if ( image_index > 2 )
image_index = max( 0, image_index - 0.25 );
else
{
if ( image_index < 1.9 )
image_index = min( 1.9, image_index + 0.1 );
else
{
image_index = 0;
sprite_index = walksprite;
isturning = false;
}
}
}
}
var dif = angle_difference( dir, lastdir );
if ( abs( dif ) > 40 )
{
image_index = 11.75;
turnwait = 30;
left = -sign( dif );
sprite_index = turnsprite;
}
}