title: Iphone, objective-c how to make a Jump method for a platformer
body: <p>I have this IBAction that is suppose to make a character onscreen jump, however when its called it just moves the character up once, then each call after that the character just moves down more and more.  This function should just be called then the character would 'jump' up and then fall straight down off the screen since i havent put in any collision with the ground.  ANy suggestions why this is happening? tim is the name of my UIImageView that holds the chracater, btw.</p>
  
  <pre><code>-(IBAction)Jump:(id)sender
  </code></pre>
  
  <p>{
      int jumpSpeed = JumpSpeedLimit;
      CGPoint newCenter = tim.center;</p>
  
  <pre><code>if(!mainJumping){
      //then start jumping
      mainJumping = TRUE;
      jumpSpeed = JumpSpeedLimit*-1;
      newCenter.x -= jumpSpeed;
      tim.center = newCenter;
  
  } else {
      //then continue jumping if already in the air
      //crazy math that I won't explain
      if(jumpSpeed &lt; 0){
          jumpSpeed *= 1 - JumpSpeedLimit/75;
          if(jumpSpeed &gt; -JumpSpeedLimit/5){
              jumpSpeed *= -1;
          }
      }
      if(jumpSpeed &gt; 0 &amp;&amp; jumpSpeed &lt;= JumpSpeedLimit){
          jumpSpeed *= 1 + JumpSpeedLimit/50;
      }
      newCenter = tim.center;
      newCenter.x -= jumpSpeed;
      tim.center = newCenter;
      /*
      //if hits the floor, then stop jumping
  
      if(tim.center.x &gt;= 360 - tim.bounds.size.height){
          mainJumping = FALSE;            
          newCenter = tim.center;
          newCenter.x = 360 - tim.bounds.size.height;
          tim.center = newCenter;
      }*/
  
  }
  </code></pre>
  
  <p>}</p>