title: Libgdx Entity Gravity
body: <p>I really don't like using box2d with Libgdx, so I set up a map from Tiled to have a rectangle for every cell in the layer. I have a player set up that should fall if it is not touching one of the rectangle, but it slowly falls through the map. </p>
  
  <pre><code>    for(int i = 0; i &lt; g.getBounds().size; i++) {
          Intersector.intersectRectangles(bounds, g.getBounds().get(i), intersection);
          if((bounds.overlaps(g.getBounds().get(i))) &amp;&amp; intersection.y &gt; g.getBounds().get(i).y) {
              vel.y = 0;
              if (MyInput.isPressed(MyInput.SPACE)) {
                  vel.y = 5;
              }
          } else {
              vel.y-=.0005f;
          }
      }
  </code></pre>
  
  <p>The for loop goes through all the rectangles to check if the player is touching the top.</p>