Blob Jump


Blob Jump is a game I created in Greenfoot. It is a slime that bounces and collects coins.
The main menu

Basic Game Stuff

Control the purple blob with WASD. But not S, as there is no downwards motions. Jump around on the carefully made grass blocks and collect the rotating shiny gold ellipses. When you reach the end of the only level, you must jump into the ground to win.


Code that was a bit hard to do

Coding the coin particles was a little difficult.

//when the blob hits the coin
public void getCoin() {
    Coin coin = new Coin();
    coin = (Coin) getOneIntersectingObject(Coin.class);
    if (coin == null) {
    } else {
        coinCount += 1;
//this creates the particles in their random locations
public void initParticle() {
    int xOffset = (Greenfoot.getRandomNumber(48)-24);
    int yOffset = (Greenfoot.getRandomNumber(48)-24);
    int xOffset2 = (Greenfoot.getRandomNumber(48)-24);
    int yOffset2 = (Greenfoot.getRandomNumber(48)-24);
    CoinParticle part1 = new CoinParticle();
    CoinParticle part2 = new CoinParticle();
    CoinParticle part3 = new CoinParticle();
    getWorld().addObject(part1,(int) this.getX() + this.getImage().getWidth()/2, (int) this.getY() - this.getImage().getHeight()/2);
    getWorld().addObject(part2,(int) this.getX() + this.getImage().getWidth()/2 + xOffset, (int) this.getY() - this.getImage().getHeight()/2 + yOffset);
    getWorld().addObject(part3,(int) this.getX() + this.getImage().getWidth()/2 + xOffset2, (int) this.getY() - this.getImage().getHeight()/2 + yOffset2);

//and this method is called for every particle to decay 
public void decay() {
    if (t &lt;= 0) {
    } else {
        t -= 3;

What happens is when the blob collides with the coin, 3 coin particles are spawned in random directions and with random images. Each coin particle decays after a certain amount of ticks.

Also, this is the code that causes the level to scroll:

int numOfWorldTiles = getWorld().getObjects(WorldTile.class).size();
for (int i = 0; i &lt; numOfWorldTiles; i++) {
     WorldTile w = ((WorldTile) getWorld().getObjects(WorldTile.class).get(i));          
     w.setLocation(w.getX() - xspeed, w.getY());


This code goes through every single tile in the level and shifts it over by the x-offset or, in this case, ‘xspeed’.


Overall, this project was very fun to make. Greenfoot was a great tool to use (as well as processing) and it has helped me advance in my programming ability. I feel that it is time for me to move on to more advanced tools like Eclipse but Greenfoot is very good for practicing.


Leave a Reply

Your email address will not be published. Required fields are marked *