friction gml code example
Example: friction gml
if (right)
{
if (hspd < spd) hspd += fric;
if (hspd >= spd) hspd = spd;
}
if (left)
{
if (hspd > -spd) hspd -= fric;
if (hspd <= -spd) hspd = -spd;
}
if (!right && !left) || (right && left)
{
if (hspd >= fric) hspd -= fric;
if (hspd <= -fric) hspd += fric;
if (hspd > -fric) && (hspd < fric) hspd = 0;
}