package de.thdeg.greiner.superpangworld.graphics.moveable;

import de.thdeg.greiner.superpangworld.gameview.GameView;
import de.thdeg.greiner.superpangworld.graphics.base.Bubble;
import de.thdeg.greiner.superpangworld.graphics.base.CollidableGameObject;
import de.thdeg.greiner.superpangworld.graphics.base.Position;

import java.awt.*;
import java.util.ArrayList;
import java.util.Random;


/**
 * The classic red, round bubble.
 */
public class RoundBubble extends Bubble {

    /** The pixel art for the bubble */
    private final static String RED_BUBBLE =
            "    RRRR    \n"+
                    "   RWRRRR   \n"+
                    "  RWRRRRRR  \n"+
                    " RWRRRRRRRR \n"+
                    "RWRRRRRRRRRR\n"+
                    "RWRRRRRRRRRR\n"+
                    "RWRRRRRRRRWR\n"+
                    "RRRRRRRRRWWR\n"+
                    " RRRRRRRWWR \n"+
                    "  RRRRRWWR  \n"+
                    "   RRRWWR   \n"+
                    "    RRRR    \n";

    /**
     * Create a round bubble with default values.
     *
     * @param gameView the {@link GameView} to display the bubble
     * @param objectsToCollideWith the list of {@link CollidableGameObject} the bubble can collide with
     */
    public RoundBubble(GameView gameView, ArrayList<CollidableGameObject> objectsToCollideWith) {
        super(gameView,objectsToCollideWith);
        this.hitBox.width = width-20;
        this.hitBox.height = height-20;
    }

    /**
     * Create a round bubble with set values.
     *
     * @param gameView the {@link GameView} to display the bubble
     * @param objectsToCollideWith the list of {@link CollidableGameObject} the bubble can collide with
     * @param size the object size
     * @param speedInPixel the speed in Pixel per tick
     * @param position the Position
     * @param spawning flag, if the bubble is spawning or not
     */
    public RoundBubble(GameView gameView, ArrayList<CollidableGameObject> objectsToCollideWith, double size, double speedInPixel, Position position, boolean spawning){
        super(gameView, objectsToCollideWith, size, speedInPixel, position, spawning);
        this.hitBox.width = (int) (width*0.8);
        this.hitBox.height = (int) (height*0.8);
    }

    @Override
    protected void updateHitBoxPosition() {
        hitBox.x = (int) (position.x + (width*0.1));
        hitBox.y = (int) (position.y + (width*0.1));
    }

    /**
     * Draws the bubble onto the canvas of the {@link GameView}.
     */
    @Override
    public void addToCanvas(){
        gameView.addBlockImageToCanvas(RED_BUBBLE, getPosition().x, getPosition().y,size, rotation);
    }

    @Override
    public void updateStatus() {

    }
}
