Hi! I couldn't get my random objects generated because of the problem with getHeight(0) near the last rows. Your help would be appreciated.
import greenfoot.*;
import java.lang.Object.*;
public class Scene extends World
{
private int count=0;
public Scene()
{
super(800, 600, 1,false);
prepare();
}
private void prepare()
{
Floor ground = new Floor();
addObject(ground,53,600);
Floor ground2 = new Floor();
addObject(ground2,160,600);
Floor ground3 = new Floor();
addObject(ground3,266,600);
Floor ground4 = new Floor();
addObject(ground4,373,600);
Floor ground5 = new Floor();
addObject(ground5,480,600);
Floor ground6 = new Floor();
addObject(ground6,587,600);
Floor ground7 = new Floor();
addObject(ground7,694,600);
Floor ground8 = new Floor();
addObject(ground8,751,600);
Character character1= new Character();
addObject(character1,400, 510);
}
public void act()
{
if(count>0) count--;
else count=20;
if(count==1)
{
int py=Greenfoot.getRandomNumber(getWidth());
addObject(new Shard(-(2+Greenfoot.getRandomNumber(3))),getHeight(0)+200,py);
}
}
}
