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); } }
public void draw(Batch batch) { super.draw(batch); for (FireBall ball : fireballs) ball.draw(batch); }