Hello everybody,
I want my programm to remove an object if the number of collected coins get 7. Can you help me please? Additionally, my counter doesn't show the score, although i used the code from another programm where it's working.
  
  
            public class Flames1 extends Animal
{ private GreenfootImage image1;
  private GreenfootImage image2;
  
  public Flames1()
  {
      image1 = new GreenfootImage("Flammen.png");
      image2 = new GreenfootImage("Flammen2.png");
      setImage(image1);
      
      
    }
    
   public void act() 
    {
        if(canSee(You.class));
        { eat();
           }
        switchImage();
    }
 
  public void switchImage()
        { if (getImage() == image1)
        {
                setImage(image2); }
                else
                {
                    setImage(image1); }
                
    }
 public void eat()
   {  
       Actor you;
       you = getOneObjectAtOffset(0, 0, You.class);
       if (you != null)
       {
           World world;
           world = getWorld();
           world.removeObject(you);
           Greenfoot.playSound("705902_SOUNDDOGS__fi.mp3"); 
        System.out.println("Sorry, start again!"); }}