title: Create Java 2D gravity?
body: <p>I'm creating java game (I'm a beginner with this for now) and I'd like to start with some kind of platform game.</p>
  
  <p>I'd like to know how I can make the player jump (I know how to move him up and down), but I don't know how how to make him go back down after going up.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>    public void keyPress() {
          if (listener.arrowUp) {
          Jump();
      }
  }
  
  private void Jump() {
      if(player.get(1).getPosY() &gt; maxJump) {
          player.get(1).moveY(-10);
      } else if(player.get(1).getPosY() == maxJump) {
          player.get(1).moveY(85);
      }
  }
  </code></pre>
  
  <p>So.. the player moves -10px upwards as long as i press 'w' and when he hits maxJump (which is 375 and players position at the start is 465) he "teleports" back to 465 instead of sliding back down like he does when going up.. It's really hard to explain this without a video, but i hope somebody understands and can help me with this.</p>