Metal Storm clone

I originally set out to create a clone of the game Metal Storm for the NES  (, this is how it turned out


Left and Right arrow keys – Move you left and right

X – Jump

Z – Shoot


Most of the work went into robot.class (the player) because of the sheer amount of code that had to be written in this class, the reason for so much code is that the player had to be able to do everything that pretty much any other class could do. The main things that were difficult in this class were platforms, limiting the amount of shots on screen at one time, and switching worlds.

The original issue with platforms is that the player would fall through them, this was fixed by just shutting gravity off while on the platforms.

The fix:

if(solidFloors != null)
grav = 0;
verticalvector = 0;

Limiting the amount of shots on screen at once was due to me not knowing certain built-in methods of greenfoot, which made me look up a fix, this is one of the few pieces of borrowed code.

The borrowed code:

public boolean continueShooting()
return getWorld().getObjects(weapon.class).size() < 3;

Switching world instances is the same deal as limiting shots.

The borrowed code:

if (getX() == getWorld().getWidth() – 1 && getWorld() instanceof world1)
Greenfoot.setWorld(new world2());


The hardest part of the enemy and player bullets was deleting them when they hit the end of the screen, this was caused by other processes that would delete them activating after it deleted itself.

The fix:

new weapon();

The worlds:

Every world was just a copy of world1 with slight variations to make them work properly, everything done here was simply and it probably has the fewest lines of code and the least work next to the platform classes.

The code for all worlds:

public class world_ extends World
public world_()
super(1400, 800, 1);
public void POPULATE()
robot player = new robot();
public void addSolidFloors()
for(int i=1;i<100;i++)
addObject(new solidFloors(), i*30-15, 730);

The enemies:

The two types of enemies are relatively simple.

Enemy (Running man):

All that this enemy does is run towards the left side of the screen and once they hit the left side they are killed.

setLocation(getX()-6, getY());


Shooting enemy:

This enemy stands there and shoots to the left. It’s also limited to only having one bullet on the screen at a time.

if (continueShooting())
int x = getX();
int y = getY()-3;

Both of them are affected by platforms, gravity, and the player’s bullets. Also if the play touches either they are killed. However there is no automatic spawning of either type just yet.

The platforms:

The platform classes do not have any code inside of them, all of it is done within whatever is touching the platform.


If you jump enough on the platforms you’ll fall through, it seems like the jump arc will just stop working if a certain piece of code is taken away, that piece of code I have yet to find, with the platforms you’re actually on the same level as them.

Things I hope to get working in the future:

Side scrolling because I worked on trying to get it in the code so long and every time I failed due to some sort of error I couldn’t figure out, having the bullets on a timer, designed levels, bosses, custom sprites, animations, and sounds. I’m probably going to bring a flash drive to my dad’s over the summer and work on this, which will be hard with a lack of internet.


This entire project made me appreciate even the worst of games more because it made me realize just how much is done by developers to create any sort of game, and my game is little more than a template for am extremely simple platformer/shooter.





Leave a Reply

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