Ball Friction

From ASSS Wiki
Revision as of 11:54, 9 March 2008 by Smong (talk | contribs) (oops, fixed mistake when I was tidying up the code)
Jump to: navigation, search
fireball()
{
   ball.workfriction = 1000000;
}

// call this per tick
updateball()
{
   if (ball.xspeed && ball.yspeed)
   {
      int workfriction = ball.workfriction / 1000;
      ball.xspeed = ball.xspeed * workfriction / 1000;
      ball.yspeed = ball.yspeed * workfriction / 1000;

      ball.workfriction -= cfg_friction;
      if (ball.workfriction < 0)
         ball.workfriction = 0;
   }
}