In my program my timer starts right when I compile the game instead of when I run the game. What should I do.
Here is the code.
private int second = 0;
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);
addObject (new Timer(), 250, 250);
populateWorld();
}
public void populateWorld()
{
for ( int count = 0; count < 1; count++)
{
int x = Greenfoot.getRandomNumber (450);
int y = 450;
addObject (new Glass(), x, y);
}
}
public void act()
{
second++;
if (second == 9)
{
int x = Greenfoot.getRandomNumber (450);
int y = 450;
addObject (new Glass(), x, y);
second = 0;
}
}
}
