Chapter 10. Game Programming: Coding for Fun

In Chapter 9, we combined animation and user interaction to make a fun app. In this chapter, we’ll build on those concepts and add elements of game design to create a game from the ground up. We’ll combine our ability to draw animations on the screen with our ability to handle user interaction, like mouse movement, to create a classic Pong-type game we’ll call Smiley Pong.

Games that we enjoy playing have certain elements of game design. Here is a breakdown of our Smiley Pong design:

  • A playing field or game board. A black screen represents half a Ping-Pong board.

  • Goals and achievements. The player tries to score points and avoid losing lives.

  • Playing pieces (game characters and objects). The ...

Get Teach Your Kids to Code now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.