Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

Q&A

Q. The A.I. code does not always get the ship completely out of the way of an asteroid. Is there a way to fine-tune the collision response code so that it never gets hit?

A. Actually, no; because there are several asteroid sprites on the screen, moving at different velocities, it’s not possible to make perfect predictions. But if the algorithm were to look left and right as well as up and down, it might be possible to improve the dodging capability of the sprite.

Q. The statistical numbers on the top right in the demo are interesting. Would it be possible to add more ships and have them compete to see which one gets across the screen without getting destroyed, or perhaps play against the player?

A. Absolutely! This is another example of gameplay that could be adapted for a real game with player input.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial