First, let's set up the new environment for the example. That is, an HTML file that will contain the
canvas
element, a jQuery library to help us in JavaScript, a JavaScript file containing the actual drawing logic, and a style sheet:index.html js/ js/jquery-2.1.3.js js/untangle.js js/untangle.drawing.js js/untangle.data.js js/untangle.input.js css/ css/untangle.css images/
Put the following HTML code into the
index.html
file. It is a basic HTML document containing thecanvas
element:<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Drawing Circles in Canvas</title> <link rel="stylesheet" href="css/untangle.css"> </head> <body> <header> <h1>Drawing in Canvas</h1> </header> <canvas id="game" width="768" height="400"> This is an interactive game with circles and lines connecting them. </canvas>...
HTML5 Game Development by Example: Beginner's Guide
By :
HTML5 Game Development by Example: Beginner's Guide
By:
Overview of this book
Table of Contents (18 chapters)
HTML5 Game Development by Example Beginner's Guide Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
Introducing HTML5 Games
Getting Started with DOM-based Game Development
Building a Card-matching Game in CSS3
Building the Untangle Game with Canvas and the Drawing API
Building a Canvas Game's Masterclass
Adding Sound Effects to Your Games
Saving the Game's Progress
Building a Multiplayer Draw-and-Guess Game with WebSockets
Building a Physics Car Game with Box2D and Canvas
Deploying HTML5 Games
Pop Quiz Answers
Index
Customer Reviews