EasyManuals Logo

Arduino Pro Mini User Manual

Arduino Pro Mini
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
Page #133 background imageLoading...
Page #133 background image
</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

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Arduino Pro Mini and is the answer not in the manual?

Arduino Pro Mini Specifications

General IconGeneral
BrandArduino
ModelPro Mini
CategoryMotherboard
LanguageEnglish

Related product manuals