I have made a code for greenfoot which i want to use in lvl 2 where it adds fire if you are not touching a certain block, which works well but the only problem is when i only want to use that code for lvl 2 not lvl 1 so when i try to run my lvl 1 the flames just get added because my actor can't see the certain block it needs to be touching to remvoe the flames so i need help making sure the flames dont get added in lvl 1 but will get added in level 2
public void RemoveFlame()
{
World world = getWorld();
if(canSee(FloorButton.class))
{
world.removeObjects(world.getObjects(Flame.class));
}
else {
if(world.getObjects(Flame.class).isEmpty())
{
world.addObject(new Flame(),550,320);
world.addObject(new Flame(),525,320);
world.addObject(new Flame(),575,320);
world.addObject(new Flame(),505,320);
world.addObject(new Flame(),600,320);
}
}
}