“Project C”


This is my first “real” game made in Java. Complete with animation, a graphical user interface, sound effects and irritating background MIDI music.

After I had learned a little about user interfaces in my Mastermind-games, and about object-oriented programing in my database program, I wanted to make a larger object-oriented project that involved both animations and user interfaces. And what is a better idéa than making a new game?

This project also introduced a few new things such as: How to use double buffering to make smooth animations, and how to integrate images (.png) into the graphics. I also learned how to write code to play sounds. This game has a few different sound effects in .wav format, and two different .MIDI soundtracks is used as background music.

In this project I use inheritance between classes to make the code more efficient. For example I have one class representing a cannonball (named “Ball”). This class describes the general properties of a cannonball, such ass weight, speed and direction and other attributes. This class also contains the math used to calculate how the ball moves through the air, and functions for accessing the balls position and image.

Then I have a class “KilledBird” that is representing a bird that has bin hit by a cannonball, this class is a superclass to the class “Ball” described above. This means that “KilledBird” inherit properties from “Ball”, for example how the ball flies through the air. This makes the code more efficient and I do not have to write the same code two times.


Download source code

Click here to download the source code.

I have used a free Java IDE called “jGRASP” to develop this program. The zip-folder contain the source files, and all image and sound files used by the game. You need to compile it before you can run it.

1 thought on ““Project C”

  1. David Lee

    Thanks for the wonderful game with source code. However, when I run the program, I get “a lot of” errors. I’ll just copy and paste the whole errors (it’s really long).

    *removed all the error messages


Leave a Reply

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

Warning: Undefined array key "rerror" in /customers/b/a/5/brinkeby.se/httpd.www/axelsdiy/wp-content/plugins/wp-recaptcha/recaptcha.php on line 291

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