Chapter 7 Writing a Game for the Motion-Sensing Game Controller

To test our game controller, we’ll program a simple Breakout[66] clone in JavaScript. The player’s goal is to destroy all bricks in the upper half of the screen using a ball. It’ll look something like the following figure.

images/arduinoid.jpg
Figure 21. Our Breakout clone Background image credit: ESA/Hubble, NASA, Digitized SkySurvey, MPG/ESO. Acknowledgment: Davide de Martin

To control the ball with the paddle at the bottom of the screen, you can tilt the controller around the x-axis to move the paddle horizontally. The game runs in a web browser, and it communicates with the Arduino via a serial ...

Get Arduino: A Quick-Start Guide, 2nd Edition 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.