This site requires JavaScript, please enable it in your browser!
Greenfoot back
Countertenor
Countertenor wrote ...

2011/11/8

Exceptions Help

Countertenor Countertenor

2011/11/8

#
Hello I need help. I must build an own exception with greenfoot. My idea is, that i will create a new greenfoot image, but the .png is not in the ordner. The exceptions must say that is not they, and the second solution are, that it can be search or choose a nother .png file.
   /**
     * Act - do whatever the Giraffe wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public Giraffe()
    {
       imageNORD = new GreenfootImage("GiraffeNord.png");
       imageNORDUNTEN = new GreenfootImage("GiraffeNordUnten.png");
       imageOST = new GreenfootImage("GiraffeOst.png");
       imageOSTUNTEN = new GreenfootImage("GiraffeOstUnten.png");
       imageSUED = new GreenfootImage("GiraffeSued.png");
       imageSUEDUNTEN = new GreenfootImage("GiraffeSuedUnten.png");
       imageWEST = new GreenfootImage("GiraffeWest.png");
       imageWESTUNTEN = new GreenfootImage("GiraffeWestUnten.png");
       TreesEaten = 0;
       CactusEaten = 0;
       
       
    
                 
    }
       
    
    
       public void act() 
    {
        checkKeypress();
        eatGras();
        eatTree();
        System.out.println("Ich hab schon " + TreesEaten + " Trees gefressen!");
        System.out.println("Ich hab schon " + CactusEaten + " Cactus gefressen!");
        
You need to login to post a reply.