import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

public class Umlaufbahn extends Actor
{   
    private int klickMondphase;
    private String datumString;

    public void act() 
    {
        if (Greenfoot.mouseClicked(this))
        {
            klickMondphase = -1;
            MouseInfo mouse = Greenfoot.getMouseInfo();
            int mouseX = mouse.getX();
            int mouseY = mouse.getY();

            if (mouseX > 405 && mouseX < 505 && mouseY > 250 && mouseY < 350)
            {
                ((Weltall)getWorld()).setzeMond(455,300);
                klickMondphase = 0;
            }

            if (mouseX > 481 && mouseX < 581 && mouseY > 430 && mouseY < 530)
            {
                ((Weltall)getWorld()).setzeMond(531,480);
                klickMondphase = 1;
            }

            if (mouseX > 650 && mouseX < 750 && mouseY > 495 && mouseY < 595)
            {
                ((Weltall)getWorld()).setzeMond(700,545);
                klickMondphase = 2;
            }

            if (mouseX > 829 && mouseX < 929 && mouseY > 430 && mouseY < 530)
            {
                ((Weltall)getWorld()).setzeMond(879,480);
                klickMondphase = 3;
            }

            if (mouseX > 895 && mouseX < 995 && mouseY > 250 && mouseY < 350)
            {
                ((Weltall)getWorld()).setzeMond(945,300);
                klickMondphase = 4;
            }

            if (mouseX > 829 && mouseX < 929 && mouseY > 85 && mouseY < 185)
            {
                ((Weltall)getWorld()).setzeMond(879,135);
                klickMondphase = 5;
            }

            if (mouseX > 650 && mouseX < 750 && mouseY > 5 && mouseY < 105)
            {
                ((Weltall)getWorld()).setzeMond(700,55);
                klickMondphase = 6;
            }

            if (mouseX > 481 && mouseX < 581 && mouseY > 85 && mouseY < 185)
            {
                ((Weltall)getWorld()).setzeMond(531,135);
                klickMondphase = 7;
            }
            if (klickMondphase >= 0)
            {
                datumString = ((Weltall)getWorld()).getDatumString();  
                datumString = ((Weltall)getWorld()).sucheDatumEinerMondphase(datumString, klickMondphase);
                ((Weltall)getWorld()).mondphaseUebersetzen(klickMondphase);
                ((Weltall)getWorld()).schreibeAnzeige(datumString, ((Weltall)getWorld()).getMondphasenName()); 
                ((Weltall)getWorld()).aendereMonderscheinung();
            }
        }  
    } 
}    

