So you’ve got some code to produce mazes; what do you do next?
The obvious answer is to make use of it put some kind of game together. Trouble is, that means learning to use Java’s GUI toolkit to put together a real GUI application. Now, I’ve done a fair amount of GUI programming over the years, so the basic concepts are familiar, and I’ve even done some Java GUIs in the distant past. And there’s a detailed Java GUI tutorial available on the Java website. Easy, right?
Wrong…because games usually have much different user interaction models than your typical GUI application. Instead of relying on high-level components like buttons and menus, you have to “paint” most of the GUI yourself, which means using the low-level drawing primitives. But that’s no problem, because there’s a tutorial for the Java 2D Graphics library. Easy, right?
Still wrong, because there’s a gap between the two tutorials. The one tells you how to assemble components into a GUI, and the other tells you how to draw; what’s needed is how to build new components that can draw game sprites and such-like.
But Google is your friend; and I found a very nice Java 2D Games Tutorial that’s exactly what I need. At the end of the first four lessons I’ve got a simple “Defender” style game, in which you can move a spaceship up and down and shoot missiles at the alien ships coming in from the right. It works nicely, and covers a lot of the skills I’d need to do something fun with moving around in a maze. The same website has its own tutorials for the Java Swing GUI toolkit and Java 2D Graphics, though I’ve not looked at those yet.