Boxman Recreated!

This Java2D game is my latest work, it is a complete re-construction of my crappy original Boxman game.

Features:
Randomly Generated Maps.
12x12 grid
Target finding enemy
Optional fixed maps.
Map maker
Screenshots in all game states
Sound
Barrier exploding bombs
Shock charges to stun enemy

I will provide a download for the .jar, and the source. Source and Jar are 100% up to date

http://dl.dropbox.com/u/59761129/Boxman_Recreated.jar [Game]
http://dl.dropbox.com/u/59761129/Source.rar [Source]

Let me know how it is, BTW. I am 14, So let me know if I am good for my age.

Programming skill doesn’t have to do much with age. (I’m 14 too)

The AI is okay for a map of that size and complexity. But on a larger map it would fail. If you put a wall between you and the enemy, it will just stay there.

It’s a pretty reasonable game. In a larger map it would be quite interesting.

Graphics would be the first improvement.

Thanks, but I don’t think there is room for graphics improvement. With the style of game. But this is by no means the extent of my ability.

When I double click on the game nothing is drawn on the screen. There are menus however. When I launch via cmd, things are drawn. I assume this error comes from Java 2D, as when used it sometimes is picky as to whether it works with the java that runs via cmd or the java that runs via double-clicking (I’m pretty sure they are separate). This isn’t worth stressing over. I looked a tiny bit at your source code and I really dislike your Variables class. Tons of static fields really aren’t pretty. I highly suggest you revise that.

EDIT: Methods class too. Everything is static there as well.

When you load the jar, sometimes the graphics don’t draw, minimize it and open it again. Sometimes the KeyListener doesnt respond. Just close and re open

And everything in the methods class is static for a reason. Less typing. I.E

Non static method:

new Methods().someVoid();

Static:

Methods.someVoid();

What Sammidysam means is that it needs to be coded in a different way.

You are missing the point of statics. Statics are supposed to be independent of the object, a value/method of the class. For example getHealth() is not to be used as a static method because the health is different per object of that class. Overall, you should (almost) always take readability/good oop design over “less typing”. And in this case, it’s not even really less typing because it’s not like you would instantiate a new object every time you would want to call a method.

I don’t think it makes too much of a difference. BTW, I made the frame adjust to the maximum size possible with the game board extending to fix as close as possible (It’s still in a perfect square)

It may not make much of a difference this time, but if you want to get better at programming you have to learn from your mistakes instead of pretending there aren’t any.

Nobody writes 100% perfect code.

Besides, if you are really going for less typing, making them not static and doing the following is even less typing:


Methods m = new Methods();
float circumference = m.getCircumference();

I just added in the circumference thing because it’s more fun.

The point stated is that static is not the answer.

I guess an example of an improvement would be making a Box class instead of storing its variables in Variables statically. Then you can get its values from a getter inside that Box class.

I completely get what you mean. And at this point I am just typing because these SMF forums wont let me post because it’s too short.

Not SMF, it’s Riven’s anti-spam value-adding anti-overquoting measures.

Oh, but its pretty annoying that I cant post a simple response without dragging it on with pointless explanations.