I need help I have an odd object and the getObjects is not finding this object for the if statement what should I change?
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Chooseworld here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Chooseworld extends World
{
public static String player;
/**
* Constructor for objects of class Chooseworld.
*
*/
public Chooseworld()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(600, 400, 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()
{
showText(" Choose Your Hero",300,50);
addObject( new Ninja(), 100, 180 );
}
public void act(){
checkClick();
}
private void checkClick(){
if(getObjects( Ninja.class).size() == 0 ){
String player = "Ninja";
Greenfoot.setWorld (new Caveworld());
}
}
}