Hello, I am programming a game with bees and I want different levels in my game. Now I have two worlds 'Level1' and 'Level2'. I want that my class 'Bij' in Actor move different in each world, so I need a code to know in which world the Actor is. I now have this:
public class Bij extends Actor
{
public void act()
{
checkToetsen();
}
public void checkToetsen(){
World world = getWorld();
if (world == Level1){
if (Greenfoot.isKeyDown("left")) {
setRotation(180);
move(2);
}
}
if (world == Level2){
if (Greenfoot.isKeyDown("left")) {
setRotation(180);
move(10);
}
}
The code with ' if (world == Level1) and if (world== Level2) doesn't work.
Can somebody help me?
