One of the most important parts of the entire game is the ability to shoot at the bad guys. For this you’ll definitely be needing some bullets (and I’ll get to the bad guys soon).
I thought adding bullet sprites would be quite complicated because it would involve finding the angle to be fired at, the start position based on the position and rotation of the character sprite, but that turned out to be quite simple in the end.
Rather than use any complicated mathematics I determined that the centre of the character sprite is something that won’t change because the character is on top of a non-moving tower. I modified the Sprite.java file in the Rokon files to include centreX and centreY values. If I eventually let the character sprite move then I will need to make sure that value gets updated, but that’s a very minor issue.
I create the bullet sprite when the user presses the trackball button, or the centre of the directional pad if that’s what the device has. The bullet sprite appears at the centre of the character sprite and has X and Y velocity applied to it like so:
I decided that I wanted to get a bit more into Android development, and I decided to go with a game this time. I have made a game for Android before, well, a kind of puzzle more than a game. It’s called Petals Around the Rose, and it basically just sits and waits for user input before anything happens. So it’s not a real-time game. This next game is going to be very different.
My aim is to make a game called Bring It! that is along the lines of the tower defence games you see quite a lot of, but with elements of games like More Rooms by Sean Cooper and Burn Zombie Burn by Doublesix Games to it.
The player will control a single character in a tower and will begin the game with a basic weapon. Waves of creatures will begin to invade and try to reach the character, and the player must kill all of these creatures. As the waves progress the creatures will get stronger, and/or come in different numbers. The player will have the ability to earn better weapons, or upgrades for current weapons. There may also be the possibility of moving to other towers depending on the level. The towers will not all be the same and will differ in strengths and weaknesses.
I am writing the game (for the time being) in Java, using the Rokonengine for Android. This uses OpenGL to create and manage the graphics.
I have never written a real-time game before. I have never written anything using OpenGL, or any other similar library. I have only ever written two things in Java. These are the hurdles I have to overcome to get a working game.