O'Reilly logo

Learn Game Programming with Ruby by Mark Sobkowicz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

End the Game

In some games, the point is to finish some task or get to the highest level. In other games, there is a score that the player can try to beat the next time he or she plays. Our game includes both kinds of goals. The player is rewarded for surviving long enough for one hundred enemies to appear, and at the same time the game counts how many enemies the player destroys. Our game ends in one of three ways:

  • One hundred enemy ships have appeared. Yay! The player has survived the wave of enemies.

  • An enemy ship has hit the player ship. The player ship is destroyed, but hopefully blew up some enemies first.

  • The player ship flew out of the top of the window. The enemy mother ship has destroyed the player ship.

However the game ends, it ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required