Exemple #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;
      }
    }
  }
Exemple #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;
      }
    }
  }
Exemple #3
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;
      }
    }
  }
 public boolean checkCollision(Vector2 point) {
   collisionCircle.setPosition(position);
   return collisionCircle.contains(point);
 }