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

2013/12/13

I need help creating a end game screen

Mutiplyyou Mutiplyyou

2013/12/13

#
i need help getting my endgame screen and it's saying "cannot find symbol- variable getwidth" i heres my world code and i have a class for the image and i get the game to stop already...
//this is world code
import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class CrabWorld here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class CrabWorld extends World
{

    /**
     * Constructor for objects of class CrabWorld.
     * 
     */
    public CrabWorld()
    {    
        super(560, 560, 1); 

        prepare();
    }

    /**
     * Prepare the world for the start of the program. That is: create the initial
     * objects and add them to the world.
     */
    private void prepare()
    {
        Worm worm = new Worm();
        addObject(worm, 33, 118);
        Worm worm2 = new Worm();
        addObject(worm2, 321, 323);
        Worm worm3 = new Worm();
        addObject(worm3, 454, 122);
        Worm worm4 = new Worm();
        addObject(worm4, 336, 136);
        Worm worm5 = new Worm();
        addObject(worm5, 260, 242);
        Worm worm6 = new Worm();
        addObject(worm6, 191, 300);
        Worm worm7 = new Worm();
        addObject(worm7, 154, 387);
        Worm worm8 = new Worm();
        addObject(worm8, 80, 486);
        Worm worm9 = new Worm();
        addObject(worm9, 498, 514);
        Worm worm10 = new Worm();
        addObject(worm10, 278, 475);
        Worm worm11 = new Worm();
        addObject(worm11, 496, 270);
        Worm worm12 = new Worm();
        addObject(worm12, 177, 45);
        Worm worm13 = new Worm();
        addObject(worm13, 435, 59);
        Worm worm14 = new Worm();
        addObject(worm14, 148, 205);
        Crab crab = new Crab();
        addObject(crab, 106, 328);
        Lobsster lobsster = new Lobsster();
        addObject(lobsster, 53, 536);
        Lobsster lobsster2 = new Lobsster();
        addObject(lobsster2, 533, 30);
        Lobsster lobsster3 = new Lobsster();
        addObject(lobsster3, 57, 36);
        Crab crab2 = new Crab();
        addObject(crab2, 377, 507);
        Crab crab3 = new Crab();
        addObject(crab3, 404, 324);
        // add these instance fields  

        removeObject(crab3);
        removeObject(crab2);
    }
    
    public void act()
    {
        if (getObjects(Crab.class).isEmpty())  
        {  
            world.addObject(new Gameover(), World.getwidth); 
            Greenfoot.stop();

        }  
    }
}
You need to login to post a reply.