I am trying to remove 2 objects but when I attempt to use the getWorld() method it says "cannot find symbol" not sure why.
public int timer = 10; //Initialises the variable timer to 10
private void initialisation()
{
GameControlsDescription gamecontrolsdescription = new GameControlsDescription();
addObject(gamecontrolsdescription, 600,350);
addObject (new GameControlsDescription(), 600,350);
TitleScreen titlescreen = new TitleScreen();
addObject(titlescreen,600,350);
addObject (new TitleScreen(), 600,350);
//Will spawn in the GameControlsDescription and TitleScreen on top of each other in a specific order.
//Due to the order the two are spawned in, the TitleScreen appears above it, so when the TitleScreen
//is removed, it will show the Game Controls Description.
timer--; //Will count down the timer
if (timer <= 5) //When the timer is less than or equal to 5
{
//World world = getWorld();
//removeObjects(getWorld().getObjects(TitleScreen.class));
//getWorld().removeObject(TitleScreen.class);
getWorld().removeObjects(getWorld().getObjects(TitleScreen.class));
}
if (timer <= 0) //When the timer is less than or equal to 0
{
//World world = getWorld();
//removeObjects(getWorld().getObjects(GameControlsDescription.class));
mainmenu(); //Calls the mainmenu method
getWorld().removeObjects(getWorld().getObjects(GameControlsDescription.class));
}
}

