Space Mission FX
For a small while now I have been playing with the preview release of JavaFX and have been quite happy with it. There have been the few bugs here and there and the netbeans plugin still has some ways to go, but hey, its a preview release, its allowed to!
I decided that I would really take some of my many many many small sample apps and make something useful/fun out of them. Some of the samples included basic key handling, interpolation/animation, binding examples, etc… you get the point, mostly different JavaFX techniques.
The results is “Space Mission FX“, a port of the classic Asteroids retro game from the 80′s.
The currently version at the original time of this posting is a stable version with no real “target” for the player, rather, just some fun shooting up some asteroids, and trying not to get killed. I certainly plan to continually grow the game over the next short while, and also re-implement it when the v1.0 SDK is released.
Also, I will be making the source available on request, and if enough people are interested, I will make it available to anyone.
This blog entry will contain dated updates, when I make them, to let you all know what exactly the latest version contains and bug fixes etc…
The game puts you “the player” in a space ship (white triangle) in the middle of the screen and randomly places Asteroids around you that move in random directions at random speeds. You navigate with the arrow keys and shoot with the space bar.
I found developing this game to be very simple, in regards to JavaFX. The only real difficulty I had was with the actual mathematics involved, which I don’t have that much experience with.
I was surprised just how much things just seemed to work using JavaFX, animations/movement, data bindings, OOP design principals, etc… and constantly adding new small features was never much more than a few tweaks and the odd new class.
The game has the typical Main.FX file which handles the initiation of the game, creation of the asteroids, spaceship, stars as well as the main collision detection timeline that handles the intersections of the on screen objects.
As you can imagine, I used basic OO design principals here to create each game entity. One class per entity, custom properties, etc… they sort of handle themselves in regards to movement and lifetime.
The game elements are as follows:
And some other misc displays and helper classes. Pretty simple huh?
19th November 20o8
Initial release of the game to the world…enjoy!
28th November 2008
* Added new scoring and level based displays to the game and cleaned up some of the code as well to help with performance.
* Added new webstart link, see below for instant Space Mission FX enjoyment.
The source code can be made upon request, and if enough people are interested, I will just make it generally downloadable.
I have been messing around with this for a few weeks now and make no claims that it is implemented the best way. Its simply one way of doing it. I am always open to suggestions, tips, ideas etc… just leave a comment.
You may also find random, unused variables, methods, etc as well for the above reason.
I also have only tried to run this version on Windows XP SP2 so far.
Getting it running:
You must have the minimum requirement for running a JavaFX application, which is making sure that you have Java 6 update 10 installed on your PC. Here is a link to the download page.
Download the distribution here: (hosted on box.net)
Extract the RAR file, and then you run the command:
java -jar “SpaceMissionFX.jar” spacemissionfx.Main
New* – Webstart download
You can now download the latest version of the SpaceMissionFX from here and be playing in no time!
Help I had/have
Any Java developer knows that the Java community is very large and very helpful, I have had a great deal of support from the following sites:
I love feedback, so if anyone has any suggestions, ideas, bugs, etc… please post a comment.