Asteroids

CPE 471-01

Fall 2014

Ian O'Rourke


Introduction:

I've implemented a simple asteroids game. The game generates five asteroids that the player must blow up. If the player is struck by an asteroid the ship will blow up.

Controls:

Keys Function
w Move forward
a Z-axis rotation in positive direction
d Z-axis rotation in negative direction
m Start/stop asteroid movement
_ Fire laser

The Ship:

I found the .obj file for the ship at tf3dm.com<http://tf3dm.com/3d-model/low-poly-spaceship-37605.html>. The first time rendered the ship, only half appeared, so I had to use a mirror matrix to create the other half.

The Asteroids:

The asteroids were created using a simple sphere and applying a texture to it. Each asteroid had a randomized location and direction.

<http://www.spiralgraphics.biz/packs/terrain_desert_barren/previews/Craterscape.jpg>

The Particles:

Particles were used to create the ship laser, and the confetti-like effect when either the ship an asteroid exploded.

Collision Detection:

The benefit of doing a 2d game in 3d is that it makes collision detection a lot simpler. Collision detection was accomplished using simple spheres. If the distance between an asteroid and the ship was less than the sum of their radii, the event is treated as a collision.