Hi, I'm trying to make my code use a certain actor only when the user is at a certain level. Basically, this actor is kind of like the a "shooting" device. In Level 1, the user is not allowed to use a shooter, but they should only be allowed to in levels 2 and 3. I am getting an error on line 3 of the code below (where the if-statements are), the compiler cannot find the symbol of ".level" even though it is in my world-class. Is there something syntactically wrong I am doing here?
public void act()
{
if(getWorld().level == 2 || getWorld().level == 3) {
setLocation(getX() + speed, getY());
if(getX()>getWorld().getWidth()-3) {
getWorld().removeObject(this);
}
else {
Actor virus = getOneIntersectingObject(Virus.class);
if(virus !=null) {
getWorld().removeObject(virus);
getWorld().removeObject(this);
}
}
}
}
