Package invaders101.entities

Source Code of invaders101.entities.Explotion

package invaders101.entities;

import invaders101.spritesystem.SpriteFactory;
import invaders101.spritesystem.AnimationEndHandler;
import invaders101.Game;


/**
* Representa un objeto que muestra la animación de una explición y al finalizar se elimina.
* @author Alejandro Cerutti, Mauricio Blint, Patricio Marrone
*/
public class Explotion extends VisibleGameEntity {

    private Game game;
    private boolean used = false;
    /**
     * Crea una nueva explosion
     *
     * @param game El juego en el cual es creada
     * @param x La posicion inicial x
     * @param y La posicion inicial y
     */
    public Explotion(Game game, int x, int y) {
        super(SpriteFactory.getInstance().getAnimation(SpriteFactory.Animations.EXPLOTION), x, y);
        this.game = game;

        AnimationEndHandler handler = new AnimationEndHandler() {

            @Override
            public void onAnimationFinished() {
                removeFromGame();
            }
        };
        this.sprite.setEndHandler(handler);
        sprite.setTrackable(this);
    }

    public void update(long delta) {
        this.sprite.update(delta);
    }

    public void notifyCollisionWith(MovingGameEntity other) {
    }

    public void removeFromGame() {
        this.game.removeEntity(this);
    }
}
TOP

Related Classes of invaders101.entities.Explotion

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.