Creating the Game

At this point you know enough about Chrome apps and controlling a motion-sensing game controller to create an entertaining video game. Writing a video game isn’t directly related to programming the Arduino. Still, it’ll show you some techniques you can use in other projects, and it’ll give you a much better understanding of how the integration of hardware and software works.

Before you dive into the code, download it from the book’s website[67] and play the game. Doing so will help you find your way through the code much easier.

When programming a browser game, you usually start with its HTML code. In our case it looks like this:

BrowserGame/Arduinoid/main.html
 
<!DOCTYPE html>
 
<html​ lang=​"en"​​>
 
<head>
 
<meta​ charset=​ ...

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.