code: def do_move(self, dt, buttons):
          
          assert isinstance(dt, int) or isinstance(dt, float)
          assert isinstance(buttons, dict)
  
          newVel = self.velocity
  
          # Redirect existing vel to new direction.
          nv = newVel.magnitude()
          newVel = nv * self.impulse_dir
  
          mv = buttons['up']
          if mv != 0:
              self.stats['battery'] -= self.battery_use['linear']
              newVel += dt * mv * self.accel * self.impulse_dir
          else:
              brake = dt * self.deaccel
              if nv < brake:
                  newVel *= 0
              else:
                  newVel += brake * -self.impulse_dir
  
          nv = newVel.magnitude()
          if nv > self.top_speed:
              newVel *= self.top_speed / nv
  
          return newVel
docs: Updates velocity and returns Rects for start/finish positions