Ejemplo n.º 1
0
  public void update(float delta) {

    velocity.add(acceleration.cpy().scl(delta));

    if (velocity.y > 200) {
      velocity.y = 200;
    }

    position.add(velocity.cpy().scl(delta));

    boundingCircle.set(position.x + 9, position.y + 6, 6.5f);

    if (velocity.y < 0) {
      rotation -= 600 * delta;

      if (rotation < -20) {
        rotation = -20;
      }
    }

    if (isFalling()) {
      rotation += 480 * delta;
      if (rotation > 90) {
        rotation = 90;
      }
    }
  }
Ejemplo n.º 2
0
  @Override
  public void update(float delta) {
    velocity.add(acceleration.cpy().scl(delta));
    boundingCircle.set(position.x + 9.0f, position.y + 6.0f, 6.5f);

    if (velocity.y < -200) {
      velocity.y = -200;
    }

    if (position.y > GameRenderer.WORLD_HEIGHT - height - 1) {
      position.y = GameRenderer.WORLD_HEIGHT - height - 1;
      velocity.y = 0;
    }

    position.add(velocity.cpy().scl(delta));

    // Rotate counterclockwise
    if (velocity.y > 0) {
      rotation += 600 * delta;

      if (rotation > 20) {
        rotation = 20;
      }
    }

    // Rotate clockwise
    if (isFalling()) {
      rotation -= 480 * delta;
      if (rotation < -90) {
        rotation = -90;
      }
    }
  }
Ejemplo n.º 3
0
  public void update(float delta, Array<Block> collisions) {
    // NOTE: figure out why legs go into block, could be order of checking for collisions/updating
    // position
    // position += velocity above collisions before changing the velocity
    acceleration.y = gravity;

    if (velocity.y < 0) onGround = false;

    if (delta
        > .1f) { // make sure time passed isn't great enough to cause clipping issues when window
                 // moved
      delta = .02f;
    }

    acceleration.scl(delta);
    velocity.add(acceleration);

    processCollisions(collisions);

    if (Math.abs(velocity.x) < .05) velocity.x = 0;
    else {
      velocity.x *= friction;
    }

    if (velocity.x > maxVel) velocity.x = maxVel;
    if (velocity.x < -maxVel) velocity.x = -maxVel;

    position.add(velocity.cpy().scl(delta));
    bounds.x = position.x;
    bounds.y = position.y;
    stateTime += delta;

    setPosition(getPosition());
  }
Ejemplo n.º 4
0
  /**
   * Ray-cast the world in constant steps specified in {@link #setRay(Vector2, Vector2, float)}
   *
   * @see World#rayCast(RayCastCallback, Vector2, Vector2)
   *     <p>Note: this implementation asumes that the raycast will hit.
   */
  public void process() {
    Vector2 step = new Vector2(endPoint);
    step.sub(beginPoint);
    step.nor();
    step.scl(stepLength);

    Vector2 endPoint = new Vector2(beginPoint);
    endPoint.add(step);

    while (!hit) {
      world.rayCast(this, beginPoint, endPoint);
      endPoint.add(step);
    }
  }
  public static boolean inLineOfSight(Vector2 p1, Vector2 p2, Polygon polygon, boolean obstacle) {
    tmp.set(p1);
    tmp2.set(p2);

    float verts[] = polygon.getTransformedVertices();

    for (int i = 0; i < verts.length; i += 2) {
      if (lineSegmentsCross(
          tmp.x,
          tmp.y,
          tmp2.x,
          tmp2.y,
          verts[i],
          verts[i + 1],
          verts[(i + 2) % verts.length],
          verts[(i + 3) % verts.length])) return false;
    }

    tmp.add(tmp2);
    tmp.x /= 2;
    tmp.y /= 2;

    boolean result = PolygonUtils.isPointInside(polygon, tmp.x, tmp.y, !obstacle);

    return obstacle ? !result : result;
  }
Ejemplo n.º 6
0
  public void drawArrow(
      Vector2 a,
      Vector2 b,
      float width,
      float feather,
      float headDist,
      float headWidth,
      Color color) {
    // Firstly, draw the body of the arrow. B is the front.
    drawLine(a, b, width, feather, color);

    // Get the direction vector a->b
    dir.set(a);
    dir.sub(b);
    dir.scl(1 / dir.len());

    // Get the point down the line that the arrow head lines get to
    d.set(dir);
    d.scl(headDist);
    d.add(b);

    // Now, move d out to the sides
    amount.set(dir);
    amount.rotate(90);
    amount.scl(headWidth);

    right.set(d).add(amount);
    left.set(d).sub(amount);

    // Draw the arrow heads to not-quite-b to make it prettier
    c.set(b);
    c.sub(dir.scl(-width * 0.2f));
    drawLine(c, left, width, feather, color);
    drawLine(c, right, width, feather, color);
  }
Ejemplo n.º 7
0
 public void update(float delta) {
   position.add(velocity.cpy().scl(delta));
   // If the Scrollable object is no longer visible
   if (position.x + width < 0) {
     isScrolledLeft = true;
   }
 }
Ejemplo n.º 8
0
  @Override
  protected void drawOnContainer(Graphics g) {
    // draw target arrows immediately above stack for active item only
    if (activeItem != null) {
      Vector2 arrowOrigin =
          new Vector2(
              activeItem.getLeft()
                  + VStack.CARD_WIDTH * FCardPanel.TARGET_ORIGIN_FACTOR_X
                  + VStack.PADDING
                  + VStack.BORDER_THICKNESS,
              activeItem.getTop()
                  + VStack.CARD_HEIGHT * FCardPanel.TARGET_ORIGIN_FACTOR_Y
                  + VStack.PADDING
                  + VStack.BORDER_THICKNESS);

      PlayerView activator = activeStackInstance.getActivatingPlayer();
      arrowOrigin = arrowOrigin.add(screenPos.x, screenPos.y);

      StackItemView instance = activeStackInstance;
      while (instance != null) {
        for (CardView c : instance.getTargetCards()) {
          TargetingOverlay.drawArrow(g, arrowOrigin, c, activator.isOpponentOf(c.getController()));
        }
        for (PlayerView p : instance.getTargetPlayers()) {
          TargetingOverlay.drawArrow(g, arrowOrigin, p, activator.isOpponentOf(p));
        }
        instance = instance.getSubInstance();
      }
    }
  }
 public SteeringOutput add(ArrayList<SteeringOutput> them) {
   for (SteeringOutput s : them) {
     velocity.add(s.velocity);
     rotation += s.rotation;
   }
   return this;
 }
Ejemplo n.º 10
0
  private void drawTriangleStrips(ShapeRenderer shapeRenderer, Color color, Color color1) {
    for (int i = 0; i < vertexDataArray.size; i++) {
      StripVertex bb = vertexDataArray.items[i];

      Array<Float> data = bb.insideVertexData;
      for (int j = 0; j < data.size - 3; ) {

        shapeRenderer.setColor(j == 0 ? color : color1);

        tmp.x = data.items[j];
        tmp.y = data.items[j + 1];
        tmp.rotateRad(angleRad);
        tmp.scl(scale);
        tmp.add(position);

        tmp1.x = data.items[j + 3];
        tmp1.y = data.items[j + 4];
        tmp1.rotateRad(angleRad);
        tmp1.scl(scale);
        tmp1.add(position);
        j += 3;

        shapeRenderer.line(tmp, tmp1);
      }
      data = bb.outsideVertexData;
      for (int j = 0; j < data.size - 3; ) {

        shapeRenderer.setColor(j == 0 ? Color.ORANGE : Color.RED);

        tmp.x = data.items[j];
        tmp.y = data.items[j + 1];
        tmp.rotateRad(angleRad);
        tmp.scl(scale);
        tmp.add(position);

        tmp1.x = data.items[j + 3];
        tmp1.y = data.items[j + 4];
        tmp1.rotateRad(angleRad);
        tmp1.scl(scale);
        tmp1.add(position);
        j += 3;

        shapeRenderer.line(tmp, tmp1);
      }
    }
  }
Ejemplo n.º 11
0
  private void drawLineFromFirstToLast(ShapeRenderer shapeRenderer, Color color) {
    shapeRenderer.setColor(color);
    for (BoundingBox br : boundingBoxes) {

      tmp.set(vertices.items[br.begin]);
      tmp.rotateRad(angleRad);
      tmp.scl(scale);
      tmp.add(position);

      tmp1.set(vertices.items[(br.begin + br.count) % vertices.size]);
      tmp1.rotateRad(angleRad);
      tmp1.scl(scale);
      tmp1.add(position);

      shapeRenderer.line(tmp, tmp1);
    }
  }
Ejemplo n.º 12
0
 public TouchableEntity getTouchableEntity(AgentEntity agentEntity) {
   TouchableEntity touchableEntity = new TouchableEntity();
   DamageEffect damageEffect = new DamageEffect();
   damageEffect.setDamage(damage);
   damageEffect.setOriginatingAgent(agentEntity);
   touchableEntity.setCollisionPolygon(new Polygon(attackPolygon.getVertices()));
   Vector2 attackPosition = new Vector2();
   if (agentEntity.isFacingLeft()) {
     attackPosition
         .add(agentEntity.getLeftBoundingSide())
         .sub(attackPolygon.getBoundingRectangle().width, 0);
   } else {
     attackPosition.add(agentEntity.getRightBoundingSide());
   }
   touchableEntity.setPosition(attackPosition);
   return touchableEntity;
 }
Ejemplo n.º 13
0
  public void updateGameOver(float delta) {

    position.add(velocity.cpy().scl(delta));

    if (position.x <= -getWidth()) {
      position.x = -getWidth() * 2;
    }
    bounds.setPosition(position);
  }
Ejemplo n.º 14
0
  public void update(float delta) {

    collisionRect.x = position.x;
    collisionRect.y = position.y;
    collisionRect.width = size.x;
    collisionRect.height = size.y;

    position.add(speed.cpy().scl(delta));
  }
Ejemplo n.º 15
0
  public void update(float delta) {

    position.add(velocity.cpy().scl(delta));

    if (position.x <= -getWidth()) {
      position.x = Gdx.graphics.getWidth();
      position.y = ((float) (Math.random() * (max))) - 10;
    }
    bounds.setPosition(position);
  }
Ejemplo n.º 16
0
    /**
     * Finds the auxiliary vertices that are used to fill all the edges that are made. There is
     * typically one of these for each vertex set by the user.
     */
    private Vector2 getAux(Array<Vector2> vertices, int i) {
      int dir = clockWisePolygon ? 1 : -1;

      if (insideStrip) dir *= -1;
      Util.getEdge(vertices, (i + vertices.size - 1) % vertices.size, m1, m2);

      nor1.set(m2).sub(m1).nor().scl(halfWidth).rotate90(dir);
      m1.add(nor1);
      m2.add(nor1);

      Util.getEdge(vertices, (i + vertices.size) % vertices.size, n1, n2);

      nor2.set(n2).sub(n1).nor().scl(halfWidth).rotate90(dir);
      n1.add(nor2);
      n2.add(nor2);

      Vector2 result = new Vector2();
      Intersector.intersectLines(m1, m2, n1, n2, result);
      return result;
    }
Ejemplo n.º 17
0
  @Override
  public Array<Vector2> getVerticesRotatedScaledAndTranslated(
      float rotation, float scale, float transX, float transY) {

    for (int i = 0; i < vertices.size; i++) {
      Vector2 w = verticesRotatedAndTranslated.items[i];
      w.set(vertices.items[i]);
      w.rotateRad(rotation);
      w.scl(scale);
      w.add(transX, transY);
    }
    return verticesRotatedAndTranslated;
  }
Ejemplo n.º 18
0
  public void update(float delta) {

    velocity.add(acceleration.cpy().scl(delta));

    // Set the circle's center to be (9, 6) with respect to the bird.
    // Set the circle's radius to be 6.5f;
    boundingCircle.set(position.x + 9, position.y + 6, 6.5f);

    if (velocity.y > 200) {
      velocity.y = 200;
    }

    // CEILING CHECK
    if (position.y < -13) {
      position.y = -13;
      velocity.y = 0;
    }

    // if(position.y<400)
    position.add(velocity.cpy().scl(delta));

    // Rotate counterclockwise
    if (velocity.y < 0) {
      rotation -= 600 * delta;

      if (rotation < -20) {
        rotation = -20;
      }
    }

    // Rotate clockwise
    if (isFalling() || !isAlive) {
      rotation += 480 * delta;
      if (rotation > 90) {
        rotation = 90;
      }
    }
  }
Ejemplo n.º 19
0
 public void drawCircle(
     TextureRegion tex, Vector2 center, float radius, Color col, float width, float vh) {
   float relRad = radius / vh;
   int pointCount = (int) (160 * relRad);
   Vector2 pos = SolMath.getVec();
   if (pointCount < 8) pointCount = 8;
   float lineLen = radius * SolMath.PI * 2 / pointCount;
   float angleStep = 360f / pointCount;
   float angleStepH = angleStep / 2;
   for (int i = 0; i < pointCount; i++) {
     float angle = angleStep * i;
     SolMath.fromAl(pos, angle, radius);
     pos.add(center);
     draw(tex, width, lineLen, (float) 0, (float) 0, pos.x, pos.y, angle + angleStepH, col);
   }
   SolMath.free(pos);
 }
Ejemplo n.º 20
0
  /**
   * Update position & velocity vectors given acceleration and deltaTime
   *
   * @param deltaTime
   */
  private void updatePosition(float deltaTime) {
    if (accel.len() > 0) {
      accel.scl(deltaTime); // dv = a * dt
      velocity.add(accel.x, accel.y); // vf = vi + dv

      // Limit velocity to max
      if (velocity.len() > MAX_VELOCITY) {
        velocity.nor().scl(MAX_VELOCITY);
      }
    }
    Vector2 deltaPos = new Vector2(velocity.x * deltaTime, velocity.y * deltaTime);

    Vector2 newDelta = Collision.tryMove(this, bounds, deltaPos);
    if (!newDelta.equals(deltaPos)) { // We hit something
      stopMoving();
    }
    position.add(newDelta); // d = d*dt
  }
Ejemplo n.º 21
0
  /**
   * Calculate the bounds of the given actors as a group
   *
   * @param actors the actors
   * @param resultOrigin result origin of the bounds
   * @param resultSize result size of the bounds
   */
  public static void calculateBounds(
      Array<Actor> actors, Vector2 resultOrigin, Vector2 resultSize) {
    resultOrigin.set(0, 0);
    resultSize.set(0, 0);
    if (actors.size == 0) {
      return;
    }

    Vector2 origin = Pools.obtain(Vector2.class);
    Vector2 size = Pools.obtain(Vector2.class);
    Vector2 leftTop = Pools.obtain(Vector2.class);
    Vector2 rightBottom = Pools.obtain(Vector2.class);
    float minX = Float.POSITIVE_INFINITY;
    float minY = Float.POSITIVE_INFINITY;
    float maxX = Float.NEGATIVE_INFINITY;
    float maxY = Float.NEGATIVE_INFINITY;
    for (Actor actor : actors) {
      calculateBounds(actor, origin, size);
      size.add(origin);
      leftTop.set(origin.x, size.y);
      rightBottom.set(size.x, origin.y);
      actor.localToParentCoordinates(origin);
      actor.localToParentCoordinates(size);
      actor.localToParentCoordinates(leftTop);
      actor.localToParentCoordinates(rightBottom);

      minX =
          Math.min(minX, Math.min(origin.x, Math.min(size.x, Math.min(leftTop.x, rightBottom.x))));
      minY =
          Math.min(minY, Math.min(origin.y, Math.min(size.y, Math.min(leftTop.y, rightBottom.y))));
      maxX =
          Math.max(maxX, Math.max(origin.x, Math.max(size.x, Math.max(leftTop.x, rightBottom.x))));
      maxY =
          Math.max(maxY, Math.max(origin.y, Math.max(size.y, Math.max(leftTop.y, rightBottom.y))));
    }
    Pools.free(origin);
    Pools.free(size);
    Pools.free(leftTop);
    Pools.free(rightBottom);
    resultOrigin.set(minX, minY);
    resultSize.set(maxX - minX, maxY - minY);
  }
Ejemplo n.º 22
0
 @Override
 public boolean touchUp(int x, int y, int arg2, int arg3) {
   Vector3 coordinates = new Vector3(x, y, 0);
   camera.unproject(coordinates);
   if (lastTouchPolygon != null) {
     Vector2 impulse =
         new Vector2(coordinates.x, coordinates.y)
             .sub(lastTouchCoordinates)
             .scl(lastTouchPolygon.getMass());
     Log.log(
         "LiveMode.touchUp",
         "applying impulse: " + impulse + " on body: " + lastTouchPolygon.getPosition());
     lastTouchPolygon.applyLinearImpulse(
         impulse, lastTouchPolygonLocalCoordinates.add(lastTouchPolygon.getPosition()), true);
     lastTouchCoordinates = null;
     lastTouchPolygon = null;
     lastTouchPolygonLocalCoordinates = null;
   }
   return false;
 }
Ejemplo n.º 23
0
 @Override
 public void fire() {
   Vector2 bullet_position =
       new Vector2(
           Utils.convertToWorld(body.getPosition().x), Utils.convertToWorld(body.getPosition().y));
   bullet_position =
       bullet_position.add(
           new Vector2(0, -Constants.ENEMY_HEIGHT / 2 - Constants.BULLET_HEIGHT / 2));
   Bullet bullet = new IceBullet(bullet_position, GameScreen.world, 0, true);
   float target_angle =
       (float)
           (Math.PI / 2
               + Math.atan2(
                   (double) this.getPosition().y - GameScreen.cannon.getPosition().y,
                   (double) this.getPosition().x - GameScreen.cannon.getPosition().x));
   bullet.body.setLinearVelocity(
       new Vector2(
           (float) ((-4f) * Math.sin(target_angle)), (float) ((2f) * Math.cos(target_angle))));
   GameScreen.bullets.add(bullet);
 }
Ejemplo n.º 24
0
  private void init() {
    r = new Random();
    showedUp = false;
    start = new Vector2();
    target = new Vector2();
    setOrbitable(false);
    double x = calculatePosition();
    double alpha = r.nextDouble() * Math.PI * 2;
    target.set((float) (Math.cos(alpha) * x), (float) (Math.sin(alpha) * x));
    radius = RADIUS;
    setlifespan(BACKUPLIFESPAWN);

    AssetLoader loader = AssetLoader.get();
    enterSound = loader.getSound(AssetContainer.SOUND_HEMAN_ENTER);
    getSound = loader.getSound(AssetContainer.SOUND_HEMAN_GET);
    twinkle = loader.getSound(AssetContainer.SOUND_TWINKLE);
    sprite = new Sprite(loader.getTexture(AssetContainer.HEMAN));

    velocity = new Vector2(target);
    if (r.nextBoolean()) velocity.rotate90(1);
    else velocity.rotate90(-1);
    // TODO does this work? do it better with 'nextFloat' ?

    start = new Vector2(velocity);
    start.scl(10);
    start = start.add(target);
    velocity.scl(-1 * VELOCITIYMULTYPLY);

    ParticleEffect effect = new ParticleEffect(ESPGame.getLevel().particleContainer.heman);
    ESPGame.getLevel().addParticleSystem(effect);
    effect.setPosition(this.position.x, this.position.y);
    effect.start();
    particleEffect = effect;

    getEffect = new ParticleEffect(ESPGame.getLevel().particleContainer.hemanGet);

    setPosition(start);
    sprite.setSize(radius * 2, radius * 2);
    sprite.setOriginCenter();
    sprite.setCenter(position.x, position.y);
  }
Ejemplo n.º 25
0
  public void defineBigMario() {
    Vector2 marioPosition = b2body.getPosition();
    world.destroyBody(b2body);

    BodyDef bDef = new BodyDef();
    bDef.position.set(marioPosition.add(0 / MarioBros.PPM, 10 / MarioBros.PPM));
    bDef.type = BodyDef.BodyType.DynamicBody;
    b2body = world.createBody(bDef);

    FixtureDef fdef = new FixtureDef();
    CircleShape shape = new CircleShape();
    shape.setRadius(6 / MarioBros.PPM);
    fdef.filter.categoryBits = MarioBros.MARIO_BIT;
    fdef.filter.maskBits =
        MarioBros.GROUND_BIT
            | MarioBros.COIN_BIT
            | MarioBros.BRICK_BIT
            | MarioBros.ENEMY_BIT
            | MarioBros.OBJECT_BIT
            | MarioBros.ENEMY_HEAD_BIT
            | MarioBros.ITEM_BIT;

    fdef.shape = shape;
    b2body.createFixture(fdef);
    shape.setPosition(new Vector2(0, -14 / MarioBros.PPM));
    fdef.shape = shape;
    b2body.createFixture(fdef).setUserData(this);

    EdgeShape head = new EdgeShape();
    head.set(
        new Vector2(-2 / MarioBros.PPM, 6 / MarioBros.PPM),
        new Vector2(2 / MarioBros.PPM, 6 / MarioBros.PPM));
    fdef.filter.categoryBits = MarioBros.MARIO_HEAD_BIT;
    fdef.filter.maskBits = MarioBros.BRICK_BIT | MarioBros.COIN_BIT;
    fdef.shape = head;
    fdef.isSensor = true;

    b2body.createFixture(fdef).setUserData(this);

    timeToDefineBigMario = false;
  }
Ejemplo n.º 26
0
  public void update(float deltaTime) {
    processKeys();

    if (state == FOLLOW) {
      target.set(map.bob.pos);
      if (map.bob.dir == Bob.RIGHT) target.x--;
      if (map.bob.dir == Bob.LEFT) target.x++;
      target.y += 0.2f;

      vel.set(target).sub(pos).scl(Math.min(4, pos.dst(target)) * deltaTime);
      if (vel.len() > MAX_VELOCITY) vel.nor().scl(MAX_VELOCITY);
      tryMove();
    }

    if (state == CONTROLLED) {
      accel.scl(deltaTime);
      vel.add(accel.x, accel.y);
      if (accel.x == 0) vel.x *= DAMP;
      if (accel.y == 0) vel.y *= DAMP;
      if (vel.x > MAX_VELOCITY) vel.x = MAX_VELOCITY;
      if (vel.x < -MAX_VELOCITY) vel.x = -MAX_VELOCITY;
      if (vel.y > MAX_VELOCITY) vel.y = MAX_VELOCITY;
      if (vel.y < -MAX_VELOCITY) vel.y = -MAX_VELOCITY;
      vel.scl(deltaTime);
      tryMove();
      vel.scl(1.0f / deltaTime);
    }

    if (state == FIXED) {
      if (stateTime > 5.0f) {
        stateTime = 0;
        state = FOLLOW;
      }
    }

    stateTime += deltaTime;
  }
Ejemplo n.º 27
0
 @Override
 public boolean update(SolGame game, SolShip owner, boolean tryToUse) {
   myShouldTeleport = false;
   if (!tryToUse) return false;
   Vector2 pos = owner.getPos();
   Fraction frac = owner.getPilot().getFraction();
   SolShip ne = game.getFractionMan().getNearestEnemy(game, MAX_RADIUS, frac, pos);
   if (ne == null) return false;
   Vector2 nePos = ne.getPos();
   Planet np = game.getPlanetMan().getNearestPlanet();
   if (np.isNearGround(nePos)) return false;
   for (int i = 0; i < 5; i++) {
     myNewPos.set(pos);
     myNewPos.sub(nePos);
     myAngle = myConfig.angle * SolMath.rnd(.5f, 1) * SolMath.toInt(SolMath.test(.5f));
     SolMath.rotate(myNewPos, myAngle);
     myNewPos.add(nePos);
     if (game.isPlaceEmpty(myNewPos, false)) {
       myShouldTeleport = true;
       return true;
     }
   }
   return false;
 }
Ejemplo n.º 28
0
 public void update(float delta) {
   position.add(speed * delta, 0);
   hitbox.x = position.x;
   hitbox.y = position.y;
 }
Ejemplo n.º 29
0
 @Override
 public void translate(Vector2 center) {
   anchorA.add(center);
   anchorB.add(center);
 }
Ejemplo n.º 30
0
  public void playerCollision(Player player, WorldManager worldManager, float delta) {

    Vector2 playerProjection = new Vector2(player.getPlayerPosition());
    Vector2 playerAcc = new Vector2(player.getPlayerAcceleration());
    playerAcc.x = 0;
    playerProjection.add(playerAcc.tmp().mul(delta));

    Chunk collidingChunk =
        worldManager.getWorld().getChunkAt(playerProjection.x, playerProjection.y);

    if (collidingChunk != null) {

      for (int x = 0; x < chunkSizeX; x++) {

        for (int y = 0; y < chunkSizeY; y++) {

          if (playerProjection.x >= (collidingChunk.getChunkX() + (x * blockSizeX))
              && playerProjection.x
                  <= (collidingChunk.getChunkX() + (x * blockSizeX) + blockSizeX)) {

            if ((playerProjection.y >= (collidingChunk.getChunkY() + (y * blockSizeY))
                    && playerProjection.y
                        <= (collidingChunk.getChunkY() + (y * blockSizeY) + blockSizeY))
                || (playerProjection.y + 32 >= (collidingChunk.getChunkY() + (y * blockSizeY))
                    && playerProjection.y + 32
                        <= (collidingChunk.getChunkY() + (y * blockSizeY) + blockSizeY))) {

              Byte[][] chunkData = collidingChunk.getChunkData();

              if (blockTypes.isVisible(chunkData[x][y])) {

                if (player.getVelocityY() < player.getFallDamageThreshold()) {

                  player.setHealth(
                      player.getHealth()
                          - Math.round(
                              (Math.abs(player.getVelocityY())
                                  / player.getFallDamageMultiplier())));
                }

                player.setVelocityY(0);
                player.setOnFloor(true);
              }
            }

          } else if (playerProjection.x + 16 >= (collidingChunk.getChunkX() + (x * blockSizeX))
              && playerProjection.x + 16
                  <= (collidingChunk.getChunkX() + (x * blockSizeX) + blockSizeX)) {

            if ((playerProjection.y >= (collidingChunk.getChunkY() + (y * blockSizeY))
                    && playerProjection.y
                        <= (collidingChunk.getChunkY() + (y * blockSizeY) + blockSizeY))
                || (playerProjection.y + 32 >= (collidingChunk.getChunkY() + (y * blockSizeY))
                    && playerProjection.y + 32
                        <= (collidingChunk.getChunkY() + (y * blockSizeY) + blockSizeY))) {

              Byte[][] chunkData = collidingChunk.getChunkData();

              if (blockTypes.isVisible(chunkData[x][y])) {

                if (player.getVelocityY() < player.getFallDamageThreshold()) {

                  player.setHealth(
                      player.getHealth()
                          - Math.round(
                              (Math.abs(player.getVelocityY())
                                  / player.getFallDamageMultiplier())));
                }

                player.setVelocityY(0);
                player.setOnFloor(true);
              }
            }
          }
        }
      }

      Vector2 playerProjectionY = new Vector2(player.getPlayerPosition());
      Vector2 playerAccY = new Vector2(player.getPlayerAcceleration());
      playerAccY.y = 0;
      playerProjectionY.add(playerAccY.tmp().mul(delta));

      for (int x = 0; x < chunkSizeX; x++) {

        for (int y = 0; y < chunkSizeY; y++) {

          if (playerProjectionY.x >= (collidingChunk.getChunkX() + (x * blockSizeX))
              && playerProjectionY.x
                  <= (collidingChunk.getChunkX() + (x * blockSizeX) + blockSizeX)) {

            if ((playerProjectionY.y >= (collidingChunk.getChunkY() + (y * blockSizeY))
                    && playerProjectionY.y
                        <= (collidingChunk.getChunkY() + (y * blockSizeY) + blockSizeY))
                || (playerProjectionY.y + 32 >= (collidingChunk.getChunkY() + (y * blockSizeY))
                    && playerProjectionY.y + 32
                        <= (collidingChunk.getChunkY() + (y * blockSizeY) + blockSizeY))) {

              Byte[][] chunkData = collidingChunk.getChunkData();

              if (blockTypes.isVisible(chunkData[x][y])) {

                player.setVelocityX(0);
              }
            }

          } else if (playerProjectionY.x + 16 >= (collidingChunk.getChunkX() + (x * blockSizeX))
              && playerProjectionY.x + 16
                  <= (collidingChunk.getChunkX() + (x * blockSizeX) + blockSizeX)) {

            if ((playerProjectionY.y >= (collidingChunk.getChunkY() + (y * blockSizeY))
                    && playerProjectionY.y
                        <= (collidingChunk.getChunkY() + (y * blockSizeY) + blockSizeY))
                || (playerProjectionY.y + 32 >= (collidingChunk.getChunkY() + (y * blockSizeY))
                    && playerProjectionY.y + 32
                        <= (collidingChunk.getChunkY() + (y * blockSizeY) + blockSizeY))) {

              Byte[][] chunkData = collidingChunk.getChunkData();

              if (blockTypes.isVisible(chunkData[x][y])) {

                player.setVelocityX(0);
              }
            }
          }
        }
      }
    }
  }