We are making a game wherein if we click the objects it will disappear. We want to know how to make an object appear wherein if we click all the objects in that level, a button should appear that if we click it, it will switch it to the next world or level.
here is our code hope you could help thanks
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class MyWorld here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class MyWorld extends World
{
/**
* Constructor for objects of class MyWorld.
*
*/
public MyWorld()
{
super(1024, 768, 1);
GreenfootImage bg = new GreenfootImage("garden_base.jpg");
bg.scale(getWidth(), getHeight());
setBackground(bg);
prepare();
}
/**
* Prepare the world for the start of the program.
* That is: create the initial objects and add them to the world.
*/
public void prepare()
{
ball ball = new ball();
addObject(ball,249,391);
car car = new car();
addObject(car,803,358);
car.setLocation(803,358);
car.setLocation(823,355);
car.setLocation(802,368);
chess chess = new chess();
addObject(chess,489,698);
cube cube = new cube();
addObject(cube,546,673);
doll doll = new doll();
addObject(doll,379,402);
teddy teddy = new teddy();
addObject(teddy,621,156);
teddy.setLocation(630,188);
nextlvl nextlvl = new nextlvl();
addObject(nextlvl,969,46);
}
}

