xvelocity -=1;
if(xvelocity < 0)
{xvelocity =0;}
xvelocity+=0.1;
xvelocity-=0.1;
if(xvelocity>=3)
{
xvelocity=3;
}
if(xvelocity<=-3)
{
xvelocity=-3;
}
//to keep his speed to constant
xvelocity-=0.1;
if(xvelocity==0)
{
xvelocity=0;
}
xvelocity+=0.1;
if(xvelocity==0)
{
xvelocity=0;
}
Users browsing this forum: No registered users and 1 guest