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

2023/2/23

image.getheight need help

pxtchey pxtchey

2023/2/23

#
+ image.getHeight() is throwing a error saying its retrieving a value when its supposed to be a variable if you need the full code for this just let me now
pxtchey pxtchey

2023/2/23

#
public void createPipe()
    {

        Pipe topPipe= new Pipe("top");
        Pipe botPipe = new Pipe("bottom");


        int pipeSpacing = 150;

        GreenfootImage image = botPipe.getImage();


        int numOfPipes = Greenfoot.getRandomNumber(10) + 4;

        pipeCounter++;




        if(pipeCounter == 50)
        {
            if(getObjects(Pipe.class).size() < numOfPipes)
            {   addObject(botPipe, getWidth(), getHeight() / 2 + image.getHeight() = Greenfoot.getRandomNumber(100) - 10);
                addObject(topPipe, getWidth(), botPipe.getY() - image.getHeight() - pipeSpacing);
            }
            pipeCounter = 0;
        }
    }
this is the full code
danpost danpost

2023/2/24

#
pxtchey wrote...
+ image.getHeight() is throwing a error saying its retrieving a value when its supposed to be a variable if you need the full code for this just let me now
The equal sign on line 23 is the problem.
You need to login to post a reply.