O'Reilly logo

HTML5 Game Development For Dummies by Andy Harris

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 3

Coding Like a Pro

In This Chapter

arrow Learning more about variables

arrow Making decisions with conditions

arrow Repeating with loops

arrow Debugging your programs

arrow Breaking up your code with functions

Computer games are complex. They are about a lot of information: scores, maps, characters, and all the data they represent. You also have complicated instructions. Even simple games are complicated enough that you’ll need to break them into smaller segments. You’ll also find that some of your code is repetitive. You’ll also want the computer to make decisions so the enemy characters will appear to think and the game will respond to different circumstances in different ways.

The basic ideas of programming are the same in any language. Programs are about data, which is stored in variables. You’ll sometimes have a chunk of code that you’ll want to combine into functions. Your program needs to do different things in different situations, and sometimes it needs to be able to repeat things. Sometimes ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required