Hey Greenfoot community,
I have this code for a sort of flappy bird game where the walls (they're called Player) are created on the left in the space code, and in the wall code they move right. At regular intervals, a wall is created. The problem that I have is that at certain intervals, seemingly random numbers of walls are made, not just one. Can anyone see the problem? Also keep in mind I'm not exactly the best at Greenfoot, and I am kind of a newbie.
Thank you.
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Space here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Space extends World
{
Long beginTime = System.currentTimeMillis();
public Space()
{
super(600, 400, 1);
addObject(new Enemy1(), 300, 200);
}
public void act()
{
if ((System.currentTimeMillis() - beginTime) % 10 == 0)
{
addObject(new Player(), 0,200 );
beginTime = System.currentTimeMillis();
}
}
}

