The R-type project is an attempt to recreate one level of the original R-type within a time limit of 2 weeks. The game was the most difficult of 3 possible school assignments and the goal of making this game was to dissect and recreate a similar game and trying to apply the techniques learned so far.
The world is created by using the Tile-mapping technique. I construct an image database by dividing the level into pieces and store the unique pieces with an ID, that same ID will also be used to create a 2D grid which will be used for the reconstruction of the level.
Because of the tile mapping I can limit the time needed to draw the world, excluding out of sight parts and because the tiles are in a square shape I can use the tiles for 2D Rectangle collision detection.
The world is a tile grid of square images what allowed me for a fast and easy Rectangle collision to check if there is collision with the world geometry. I also used Rectangle collision for detection with the other entities in the world because the game did not require a more accurate detection.
The player is able to shoot a simple bullet and a charged bullet that goes through multiple enemies and is bigger. The player can also obtain an additional gun.
- Shoot (standalone).
- Have multiple levels.
- Shoot backwards.
The enemies have 2 collision rectangles. One is to detect collision with the player and the other one is to detect if the player is in attack range. Except the red faces, the movement is on rails.
Just as the main game there is a circle that only shoots once the player is in it. The player can destroy the circle by hitting the ball component at the right time.
For the stars and bullets I made use of an entity pool, storing and/or displacing them once they should be deleted rather than deleting them. If not I would have to delete and recreate them all the time.
Once I was done with the main game I made a simple shipbuilding gimmick allow the player to customize his ship. I create a new image and the draw the player selected images to it. Using the same aspect ratio’s as the original ship I did not have to worry about breaking the game.
I also integrated SDL_Mixer to be able to play some background music.