Writing a 2D arcade game using Java2D API

Every now and again I get the urge to develop a game in Java, but I never get it complete. I’ve done a few prototypes modeling bouncing balls and simplified gravity on moving objects, but have never finished a game to completion (in Java at least – I wrote some simple games in Sinclair BASIC almost 20 years ago, and also a 2D side scroller variant in STOS BASIC on the Atari ST sometime in the late 80s).

Once of my main hurdles in Java has been ‘how do I get stuff on the screen?’. I’ve tried things in Applets using the Graphics Class, and also looked at very simple tile-based graphic layouts using, of all things, a GridLayout in Swing. I just found this tutorial however, which shows incredibly simply, how to the the Java2D api to write images to the screen using Buffering. This is an awesome article because it bridges the gap for me – I’ve read a few Java2D articles and skimmed through the Java2D online tutorials, and the part that seems to be missing in most is how you actually get an instance of the Graphics2D class. Now to go away and do something creative 🙂 Actually, I’m going to have a crack at a Nintendo ‘Game & Watch’ style simple game…. I’ll keep you posted on how it goes…

(I don’t know which came first, but the article mentioned above is also extended somewhat in this other article – you can see there are name changes, but it’s the same code… I get the feeling the first article came first…)

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.