title: moving an object from point to point in a linear path
body: <p>I'm trying to move a sprite across the screen in a straight line, towards on the location where've I touched the screen, what i did was upon the update() in each loop , it checks to see if the current sprite's location x y is == to the destination x ,y  . if it hasn't sprite's x++ and y++...
   the thing is ..it ain't moving in a straight line... as there are cases where the x or y coordinate reaches the destination x or y first... how do i changed it so that the both x and y meets the destination together?</p>
  
  <p>my current pseudo code for the sprite object</p>
  
  <pre><code>             destX = destination X
               destY = destination Y
  
               posX = current X
               posY = current Y
                 public void update(){
                  if(destX &gt; posX &amp;&amp; destY &lt; posY)
                  {
  
                      posX++;
                      posY--;
                  }
                  else if (destX &gt; posX &amp;&amp; destY &gt; posY){
                      posX++;
                      posY++;
                  }
                  else if(destX &lt; posX &amp;&amp; destY &gt; posY)
                  {
                      posX--;
                      posY++;
                  }
                  else if(destX &lt; posX &amp;&amp; destY &lt; posY){
                      posX--;
                      posY--;
                  }
                  else if(destX &lt; posX)
                      posX--;
                  else if(destX &gt; posX)
                      posX++;
                  else if(destY &lt; posY)
                      posY--;
                  else if(destY &gt; posY)
                      posY++;
  </code></pre>