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

2020/11/19

Removing walls at separate times, using levers

koil koil

2020/11/19

#
I have a puzzle game, and the goal is to "push" the levers with no order, but once you go through a lever it disappears and it changes the pipe(wall) to a more damaged pipe, until it gets removed and the player goes to the next level, having 3 levels of pipe damage, which are 3 different images for each, which are on top of each other and my train of thought was to remove one by one each time you pick a lever.
public void nextNivel()
    {
     if (isTouching(Player.class)) 
        {
     
        if(getWorld().getObjects(Lever.class).size() == 3)
        {
            getWorld().removeObjects(getWorld().getObjects(FirstPipe.class));
            getWorld().removeObject(this);
        }
        if(getWorld().getObjects(FirstPipe.class).size() = 2)
        {
            getWorld().removeObjects(getWorld().getObjects(Broken1.class));
        }
        
        
        
    }    
    }
danpost danpost

2020/11/19

#
koil wrote...
I have a puzzle game, and the goal is to "push" the levers with no order, but once you go through a lever it disappears and it changes the pipe(wall) to a more damaged pipe, until it gets removed and the player goes to the next level, having 3 levels of pipe damage, which are 3 different images for each, which are on top of each other and my train of thought was to remove one by one each time you pick a lever. << Code Omitted >>
What class is the code given in? and what class or classes make up the pipe that breaks up?
koil koil

2020/11/19

#
Thank you for all the info you give on this platform, it worked! You are a god.
koil koil

2020/11/19

#
Your previous reply actually made me realise what was wrong thank you for the concern anyways
You need to login to post a reply.