How much help do you need?
I downloaded your game and the first thing I noticed was that the players could slip through the ground. I simplified this by making one ground object. You can add the following code and then adjust the addObject() in your world class so that you spawn one groung (X-coordinate 250).
public Ground()
{
GreenfootImage image = new GreenfootImage(400,10);
image.drawRect(0,0,400,10);
image.setColor(Color.RED);
image.fillRect(0,0,400,10);
setImage(image);
}
@Gus, your code extends the ground object to the edges of the world, which was part of the problem. The other part was the height of the ground, which you did not account for.
public Ground()
{
GreenfootImage image = new GreenfootImage(400, 50);
image.setColor(Color.RED);
image.fillRect(0, 0, 400, 10);
setImage(image);
}
You will need to add 20 to the y-location of where the ground is added into the world to get the top edge of the ground at the same location as it was previously.
2013/5/17
2013/5/17
2013/5/17