Book Image

Learn HTML5 by Creating Fun Games

By : Rodrigo Silveira
Book Image

Learn HTML5 by Creating Fun Games

By: Rodrigo Silveira

Overview of this book

HTML is fast, secure, responsive, interactive, and stunningly beautiful. It lets you target the largest number of devices and browsers with the least amount of effort. Working with the latest technologies is always fun and with a rapidly growing mobile market, it is a new and exciting place to be."Learn HTML5 by Creating Fun Games" takes you through the journey of learning HTML5 right from setting up the environment to creating fully-functional games. It will help you explore the basics while you work through the whole book with the completion of each game."Learn HTML5 by Creating Fun Games" takes a very friendly approach to teaching fun, silly games for the purpose of giving you a thorough grounding in HTML5. The book has only as much theory as it has to, often in tip boxes, with most of the information explaining how to create HTML5 canvas games. You will be assisted with lots of simple steps with screenshots building towards silly but addictive games.The book introduces you to HTML5 by helping you understand the setup and the underlying environment. As you start building your first game that is a typography game, you understand the significance of elements used in game development such as input types, web forms, and so on.We will see how to write a modern browser-compatible code while creating a basic Jelly Wobbling Game. Each game introduces you to an advanced topic such as vector graphics, native audio manipulation, and dragging-and-dropping. In the later section of the book, you will see yourself developing the famous snake game using requestAnimationFrame along with the canvas API, and enhancing it further with web messaging, web storage, and local storage. The last game of this book, a 2D Space shooter game, will then help you understand mobile design considerations.
Table of Contents (14 chapters)

HTML5 – a game changer


Back when the World Wide Web was first introduced, its founders had one thing in mind—information exchange. Later, HTML was developed, with the goal of describing text documents. Again, the main aim was to aid the exchange and distribution of text documents.

Although HTML5 is fully backwards compatible, and still provides a terrific paradigm for information distribution, it is also designed with applications in mind. Today the Web is no longer used only for information exchange. People are now using the Web as a means to find entertainment—to watch movies, listen to the radio, and especially to play complete, full-featured video games.

HTML5 is a game changer in at least three ways, namely its wide adoption, its powerful capabilities, and the fact that it brings its features right to the browser—no plug-ins required. These three ways are explained as follows:

  • Wide adoption: Not only are there over a billion people using the World Wide Web, but just about any device connected to it is able to execute HTML5 code. That means your program HTML5 games to be played on desktop computers, laptops, smart mobile phones, tablets, and even television sets.

  • Powerful capabilities: Before HTML5, many commonly used tasks and features had to be programmed every time by developers—the drag-and-drop functionality, form validation, custom font faces, and so on. With HTML5, all of those things (and much more) are done for you by the web browser. You no longer need tens or hundreds of lines of code to create a drag-and-drop effect. The browser makes that job trivial for you, the developer.

  • No plug-ins: While many of the features that HTML5 bring to the table had already bee seen before by means of third-party software, such as Macromedia Flash (which was later acquired by Adobe), or Java applets. The challenge with using these technologies as part of your web applications was that users had to install (and frequently upgrade) plug-ins that extended the browser's native capabilities. No only that, but developers also needed to learn and maintain at least two separate code bases, written in different languages. HTML5 solves that problem by cooking its own powerful feature set, allowing users to have a similar, and often better experience with the software, and best of all, without installing or worrying about a single plug-in.

In summary, the Web has gone from being a place to exchange information, to a place where users go to find quality entertainment. Responsive to this change, HTML5 has been designed to empower you to create the entertainment that users are looking for on the Web, in the form of fun video games.