title: Asteroids game c++ inertia
body: <p>I'm trying to make my asteroid keep moving once I press a button.</p>
  
  <pre><code>void Ship::applyThrust()
  
  {
  
     _v.setX(_v.getX() - sin(2 * M_PI * (_angle / 360)) * 2.5); 
  
     _v.setY(_v.getY() + cos(2 * M_PI * (_angle / 360)) * 2.5); 
  
  }
  </code></pre>
  
  <p>This is the formula I have to help my ship move. </p>
  
  <p>The _v.setX and _vsetY updates the X and Y position </p>
  
  <p>The M_PI is just 3.14. </p>
  
  <p>The _angle is how much of a rotation I set with my left and right arrow keys and </p>
  
  <p>The 2.5 is how many frames per I want it to move</p>
  
  <p>My ship is moving just fine, the problem is that I'm trying to simulate space inertia and have my ship continue moving. </p>
  
  <p>Any ideas on how would be the logic for this?</p>
  
  <p>Thanks,</p>