import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.util.*;
/**
 * Write a description of class throw_bottlecheck here.
 * 
 * @author Jonathan, Florian
 */
public class throw_bottlecheck extends Element

{
    public static boolean throw_bottleavailable = false;
    private List<Actor> objects = new ArrayList<Actor>();
    private int sizex = 30;
    private int sizey = 30;
    private long throw_bottleavailablemillis = 0;
    private static double count = 1;
    private String[] throw_bottleenGefunden = {"Glückwunsch!", "Du kannst nun Flaschen auf die Zombies werfen", "", "Benutze sie als Waffe gegen die Zombies", "Schaue in die gewünschte Richtung und","drücke M zum Werfen"};
    private static boolean isSmaller = false;
    private GreenfootImage img;
    public throw_bottlecheck()
    {
        img = new GreenfootImage("Skins/Waffe/JackDaniels10.png");

        setImage("Skins/leer.png");

    }

    /**
     * Act - do whatever the throw_bottlecheck wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act() 
    {
        // Add your action code here.

        if (isTouching(Linch.class))
        {
            if(!throw_bottleavailable){
                Background.msg(throw_bottleenGefunden);
                throw_bottleavailablemillis = System.currentTimeMillis();
                throw_bottle.available = true;
            }
            throw_bottleavailable = true;

        }
        if(throw_bottleavailable){

            setLocation(320,240);
            if(count <=1000 && !isSmaller){ 
                count = count*1.1+5;
            }else if(count > 1000 && !isSmaller){
                isSmaller = true;
            }else if(count >= 1 && isSmaller){
                count= count/1.3;
            }else if(count < 1 && isSmaller){
                getWorld().removeObject(this);
            }
            GreenfootImage img2 = new GreenfootImage("Skins/Waffe/JackDaniels10.png");
            img2.scale((int)(sizex+count), (int)(sizey+count));
            setImage(img2);
        }else{
            setImage(img);
        }

    }    
}
