Hello everyone!!
I tried learning some things from the FP Demo but i cant understand the part about how the player is moving.
var sign:Number;
if (speedX != 0)
{
sign = speedX > 0 ? 1 : -1;
while (speedX != 0)
{
speedX -= sign;
if (collide("solid", x + sign, y))
{
speedX = 0;
}
else x += sign;
}
}
If speedX is used for acceleration and a number is already stored in it, how does the object moves with our existing acceleration if we are using sign to change it’s x position?