EasyManua.ls Logo

Arduino uno

Arduino uno
311 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
</head>
<body>
<div id="game">
<div id="playfield">
<div id="paddle"></div>
<div id="ball"></div>
<div id="winner" class="message">
<p>You win!</p>
</div>
<div id="game_over" class="message">
<p>Game Over</p>
</div>
</div>
<div id="stats">
<div>Lives: <span id="lives"/></div>
<div>Score: <span id="score"/></div>
</div>
</div>
<audio src="sound/awake10_megaWall.mp3" autoplay loop/>
<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/serial_device.js"></script>
<script src="js/game_controller.js"></script>
<script src="js/arduinoid.js"></script>
</body>
</html>
Theres nothing special about this HTML document. At the top we associate
the document with a style sheet named
arduinoid.css
. Well specify all things
related to layout in this file.
Next, we define a couple of
<div>
elements. The main element has its
id
attribute set to
game
, and it contains all the other elements. Most elements
are fairly self-explanatory. The
playfield
element is where the action happens.
It hosts a
paddle
and a
ball
. These elements represent the games main
objectsthat is, the players paddle and the ball.
The
winner
and
game_over
elements contain messages well display in case the
player has won or lost the game. Theyll be invisible when the game starts.
In the
stats
element, you can find the games most important statistical infor-
mation: the number of lives left and the current score.
After that, we add a cool chiptune
3
created by Alex Smith
4
to the game using
the
audio
element. The
autoplay
attribute starts the song immediately, and the
loop
attribute makes it loop forever. Its a great song, so that doesnt hurt.
3.
http://opengameart.org/content/awake-megawall-10
4.
http://cynicmusic.com/
report erratum discuss
Creating the Game 115
www.it-ebooks.info

Table of Contents

Other manuals for Arduino uno

Related product manuals