Space Prisoner 1.4

Space Prisoner 1.4
Work on Space Prisoner has ceased.
However, I will continue to update the high score list as scores come in.

Thursday, May 15, 2008

Added rudimentary artificial intelligence to the enemy ships; they are now "aware" of the player ship, and will actively attempt to shoot the player down.

A minor problem that I had to solve was: how to take the delta vector between the enemy ship and the player ship, and translate that into a target body attitude for the enemy ship. This was solved by a quick trip to Mathematica, and their excellent page on spherical coordinates. The conversion is as follows:

theta (swivel) angle = arctan(dy/dx)
phi (tilt) angle = arccos(dz)

where dx, dy and dz are the attributes of a vector d describing the distance and direction from the enemy ship to the player ship. This vector must first be normalized.

No comments: