HTML and CSS Reference
In-Depth Information
CHAPTER 8
Canvas Game Essentials
Games are the reason why many of us initially became interested in computers, and
they continue to be a major driving force that pushes computer technology to new
heights. In this chapter, we will examine how to build a mini game framework that can
be used to create games on the canvas. We will explore many of the core building blocks
associated with game development and apply them to HTML5 Canvas with the Java-
Script API.
We don't have the space to cover every type of game you might want to create, but we
will discuss many elementary and intermediate topics necessary for most games. At the
end of this chapter, we will have a basic clone of Atari's classic Asteroids game. We will
step through the creation of this game by first applying some of the techniques for
drawing and transformations specific to our game's visual objects. This will help get
our feet wet by taking some of the techniques we covered in previous chapters and
applying them to an arcade game application. Next, we will create a basic game frame-
work that can be applied to any game we want to make on the canvas. Following this,
we will dive into some game techniques and algorithms, and finally, we will apply
everything we have covered to create the finished product.
Why Games in HTML5?
Playing games in a browser has become one of the most popular activities for Internet
users. HTML5 Canvas gives web developers an API to directly manage drawing to a
specific area of the browser. This functionality makes game development in JavaScript
much more powerful than ever before.
Canvas Compared to Flash
We've covered this topic in earlier chapters, but we expect that a large portion of readers
might have previously developed games in Flash. If so, you will find that Canvas offers
similar functionality in certain areas, but lacks some of the more refined features of
Flash.
 
Search WWH ::




Custom Search