This site requires JavaScript, please enable it in your browser!
Greenfoot back
R0b1n
R0b1n wrote ...

2019/3/7

Level 1 problem

R0b1n R0b1n

2019/3/7

#
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);
            }
        }
    }
danpost danpost

2019/3/7

#
Your new condition is:
if (world instanceof lvl2)
R0b1n R0b1n

2019/3/8

#
thank you :D
You need to login to post a reply.