Chapter 5

The Sauce Bottle Game

In This Chapter

arrow Making a sauce bottle simulator

arrow Reading a digital input

arrow Creating realistic graphics

arrow Understanding the beginnings of the Pygame framework

The project in this chapter is just about the most fun you can have with a single contact input. Whether you call it catsup, ketchup, or sauce, it’s a thixotropic fluid, which means it changes its viscosity (runniness) according to the agitation of the fluid.

The Game

The game is simply an interactive sauce bottle where shaking can be sensed by the Raspberry Pi. This is mirrored on the screen by a graphic of the same bottle. However, on the screen, the sauce bottle can be seen to slowly empty in response to the shaking. The idea is to get the bottle emptied in the shortest possible time.

This game is a great introduction to the interaction of hardware and software. Figure 5-1 shows the hardware bottle next to a monitor showing the graphic bottle.

image

Figure 5-1: The finished game.

Parts

The parts ...

Get Raspberry Pi Projects For Dummies 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.