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

2014/4/23

My greenfoot game will not load even though there are not any syntax errors what should i do? Here is the code for my world.

jmdreyer jmdreyer

2014/4/23

#
import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Darkness here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Darkness extends World
{

    /**
     * Constructor for objects of class Darkness.
     * 
     */
    public Darkness()
    {    
        // Create a new world with 600x400 cells with a cell size of 1x1 pixels.
        super(500, 500, 1); 
        addObject(new Marble(), 250, 150);
        populateWorld();
    }

    public void populateWorld()
    {
        addObject ( new Glass(), 450, 450);
        for ( int count = 0; count < 4; count = count)
        {
            int x = Greenfoot.getRandomNumber (450);
            int y = Greenfoot.getRandomNumber (450);
            addObject (new Glass(), x, y);
        }
    }     
}
lordhershey lordhershey

2014/4/23

#
you have an infinite loop here:
for ( int count = 0; count < 4; count = count)  
make it
for ( int count = 0; count < 4; count++)  
jmdreyer jmdreyer

2014/4/25

#
I made that change but the world will still not show up.
danpost danpost

2014/4/25

#
From the menubar, select "Controls>Show debugger"; then, click on the 'Terminate' button. Hope that helps.
jmdreyer jmdreyer

2014/4/28

#
It worked thank you very much
You need to login to post a reply.