package xaero.rotatenjump.game.object;

import xaero.rotatenjump.game.Game;

/**
 * Created by xaero on 10/07/2017.
 */

public class EnemyTwoHit extends Coin {

    private boolean hitOnce;
    private boolean colliding = false;
    private boolean lastColliding = false;

    public EnemyTwoHit(float posX, float posY) {
        super(posX, posY);
        hitOnce = false;
    }

    @Override
    public void update(Game game){
        if(!lastColliding && colliding){
            if(!hitOnce)
                hitOnce = true;
            else
                game.getCoins().remove(this);
        }
        lastColliding = colliding;
        colliding = false;
    }

    @Override
    public void render(Game game, float partialTicks) {
        /*super.render(canvas, paint, partialTicks);
        SimpleGraphics.push(canvas);
        if(hitOnce)
            paint.setColor(Color.RED);
        else
            paint.setColor(Color.YELLOW);
        SimpleGraphics.scaledTranslate(canvas, (lastPosX + (posX - lastPosX) * partialTicks), lastPosY + (posY - lastPosY) * partialTicks);
        SimpleGraphics.scaledCircle(canvas, paint, COIN_SIZE);
        paint.setColor(Color.BLACK);
        SimpleGraphics.pop(canvas);*/
    }

    public void getHit(Game game) {
        colliding = true;
    }
}
