예제 #1
0
파일: Mario.java 프로젝트: B1z/SuperMario
  public void update(float dt) {
    // update our sprite to correspond with the position of our Box2D body
    if (marioIsBig)
      setPosition(
          b2body.getPosition().x - getWidth() / 2,
          b2body.getPosition().y - getHeight() / 2 - 6 / MarioBros.PPM);
    else
      setPosition(
          b2body.getPosition().x - getWidth() / 2, b2body.getPosition().y - getHeight() / 2);
    // update sprite with the correct frame depending on marios current action
    setRegion(getFrame(dt));
    if (timeToDefineBigMario) defineBigMario();
    if (timeToRedefineMario) redefineMario();

    for (FireBall ball : fireballs) {
      ball.update(dt);
      if (ball.isDestroyed()) fireballs.removeValue(ball, true);
    }
  }
예제 #2
0
파일: Mario.java 프로젝트: B1z/SuperMario
 public void draw(Batch batch) {
   super.draw(batch);
   for (FireBall ball : fireballs) ball.draw(batch);
 }