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

2016/11/1

What is wrong with this code?

Jacobblepop Jacobblepop

2016/11/1

#
/**
     * If the Rabit is at the edge of the world or is hit by a Laser blast
     * it will be removed and it will create a new Rabbit. Also randomly
     * creates rabbits
     */
    public void makeRabbit() 
    {
        World world = getWorld();
        Rabbit new = new Rabbit(counter);
        int worldHeight = world.getHeight();
        int worldWidth = world.getWidth();
        if(Greenfoot.getRandomNumber(9999) < 9) {
            world.addObject(newRabbit, worldWidth, Greenfoot.getRandomNumber(worldHeight));
        }
    }
danpost danpost

2016/11/1

#
Jacobblepop wrote...
What is wrong with this code?"
Line 9 should start 'Rabbit newRabbit = ...".
You need to login to post a reply.