GMS 2.3+ My object's sprite jitters when stops, why?

DonBaCat

Member
GIF here:
The character surrounding the player (the middle one) seems jittering when stop moving.

GML:
if friend_add=true
{
    if (point_distance(x, y, pos_x, pos_y) > maximum_spd)
    {
        time --;
        if time<=0
        {       
            state=states_Friend.move;
            spd = Approach(spd, maximum_spd, acc);
            var xdiff = sign(pos_x - x);
            if (xdiff != 0)
            image_xscale = xdiff;
        }
    }
    else
    {
        time= random(30);
        if spd <=0 state=states_Friend.idle;
        spd = Approach(spd, 0, acc);
    }
    var pd = point_direction(x,y,pos_x,pos_y);
    hsp = lengthdir_x(spd, pd);
    vsp = lengthdir_y(spd, pd);

    x = x + hsp;
    y = y + vsp;
}
 
It looks like an animation issue, and it's impossible to determine what is causing it without seeing your animation code (image_index, and image_speed)
 
Top