Asteroid Blaster is a simple 3d asteroid shooter game.
W - Tilt up
A - Turn left
S - Tilt downard
D - Turn right
Space - Shoot
Up - Speed up
Down - Slow down
Mouse can also be dragged to change direction
Objective: Blow up as many asteroids as possible.
Asteroid Blaster is a simple asteroid shooter game. The player is given a spacecraft that can travel at extremely high speeds through asteroid belts and open space. The spaceship has infinite ammo and one of its shots can blow up a whole asteroid!
The image above shows a barrage of red missiles that have been fired.
Skybox: In order to recreate the illusion of infinite space, a skybox was used. This worked by creating a box and applying a space texture to the interior. When the camera was moved, the skybox was moved along with it.
The player in the game has the ability to fire a weapon and blow up asteroids. In order to detect if a projectile had come in contact with an asteroid, both were modeled as spheres and if the distance between them was smaller than the sum of their radii, a collision was detected.
The game used assets available online. To get them imported into the 3d world, an OBJ loader was used.
A maximum of 15 projectiles are allowed to be fired at any one time in order to keep computation and memory usage low. Projectiles only exist until they have reached their maximum travel distance.
There is a defect in the program that causes the spaceship to roll when performing normal turns. I found the defect actually enhanced the program and made no attempt to remove it. To view the cause of this defect, examine the function updateTransformations(). It occurs when rotating on the x-z plane every 360 degrees.
The spaceship currently does not blow up if it collides with an asteroid. The only reason for this not currently being included was time constraints.
All assets were found at sharecg
. ShareCG is an excellent resource for finding free assets to use in 3d programs.
There was only one texture used in this program for the skybox. I am unaware of where I originally found the image for the space background. It is provided in bmp format here