public void act()  
  {  
    int x = getX();
    int y = getY();

    if (goDown)
    {
        setLocation(getX(), getY()+1);  
    }
    else{
        setRotation(180);
        setLocation(getX(), getY()-1);
    }

    if (Greenfoot.mouseClicked(this)) 
    {
        selected = true;
    }

    if (Greenfoot.mouseClicked(null) && !Greenfoot.mouseClicked(this)) selected = false;

    if (selected && Greenfoot.isKeyDown("left"))
    {
        setLocation(getX()-1, getY());
    }
   
    if (selected && Greenfoot.isKeyDown("right"))
    {
        setLocation(getX()+1, getY());
    }
   
    if(atWorldEdge()) 
    {
        goDown = false;
    }
    
    if (getY() == 1) getWorld().removeObject(this); 
  }