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

Report as inappropriate.

programmer274 presents ...


My Game

A cheesy arcade style fighter game

1536 views / 300 in the last 7 days

Tags: game with-source

open in greenfoot
Your browser does not support the canvas tag.


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); }


Oh, looks like that wasn't the problem, but you should still add that. It cleans things up a little bit.


@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.

Want to leave a comment? You must first log in.

Who likes this?

No votes yet.