Articles Section Index | Page 3
Artificial inteligence used in a Pong game
Many games need two players but mostly you have to play on your own, because no one is there to play with you. For these situations you want an opponent that is not too strong but is strong enough ...more
Bounce a ball
Well Ok we are now able to move a ball across the applet without any flickering of the screen. This means that we know the two most important steps to program a game with animated objects. In this ...more
Double buffering
I'm sure you recognized in the first applet that the circle is flickering. There is a very simple reason for this. Everytime the paint - method is called by repaint() the applet screen is cleared c...more
Event handling of key events
Handling key events in applets works very similar to the mouse event handling I talked about in the chapter before. There is one special method for every possible event (key down, key up). You have...more
Handle mouse events
I think there is no game that doesn't "interact" with the player. In our case, as a programmer, you have two possibilities to allow the player to interact with the computer: the player has to use t...more
Landscapegenerator
In this chapter I want to teach you the method to create 2D landscapes I used in my game Castles. Again, I won't talk about the Main class, which controls the applet in general and I won't talk abo...more
Leveleditor
In this chapter we discuss how to program a leveleditor that can used in any arraybased game. An arraybased game might be a Breakout clon, Boulderdash, PacMan or a Nibbles clone like our game Snaki...more
Our first game
In our game, the player has to shoot at two balls, (a red and a blue one), which are flying around in our applet. The direction and speed will be chosen at random; the user can hit a ball by clicki...more
Randomize the movement direction of the two balls
As I said in the second chapter, we will move our ball in this game not only in the x - direction but in the y - direction, too. To do this we have to add a y_speed vector to the applet as well as ...more
Start the game with a double click on it and finish it if the player loses all his lives:
Now we have almost done it, there is just one thing left to do: We want to start the game when the player clicks two times on the applet (double click) and not earlier. The advantage of this is not...more
The sourcecode of the most important methods.
As always I won't discuss every single line of code in detail, but I'll talk about the most important methods and classes. These are the class LevelReader and its method readLevels() and the class ...more
Using pictures in applets
Just like "adding" sound files to an applet you can add pictures. Now I want to explain to you how to do this by adding a background picture to our "ball bounce" applet. Again we have to declare an...more
Using SOAP with Java
Hello welcome to the first part of my 3 series articles on developing SOAP based applications using Java. This series is not a detailed description of SOAP protocol but just a quick-start tutorial ...more
Using SOAP with Java | The Client
Once you have followed the previous instructions, we can test your installation by accessing the URL: http://localhost:8080/soap/admin. You will see a default admin page for Apache SOAP coming up. ...more
Using sounds in applets
Sound files make a game much more exiting and they are really easy to "add" to a applet! It will take you just a few lines of code. In this chapter I want to show you, with the help of the "ball bo...more