O'Reilly logo

Raspberry Pi Projects For Dummies by Brock Craft, Jonathan Evans, Mike Cook

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

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 ...

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