Game Programming

View:  
Sorted by:  

How to Create Tiles in Your HTML5 Game

A tile-based world is a technique used in HTML5 games to provide interesting flexible backgrounds without huge memory costs. The basic idea is to take a number of small images and use them in combination [more…]

How to Create the Basic for Loop in Your HTML5 Game

Your HTML5 game will undoubtedly need a for loop at some point. The standard for loop counts the values between 1 and 10. The Count to Ten button triggers the [more…]

How to Make a Basic While Loop in Your HTML5 Game

for loops are useful when you know how often a loop will continue in your HTML5 game, but sometimes you need more flexibility. The while loop is based on a simple idea. It contains a condition. When the [more…]

How to Manage Bugs with a Debugger in Your HTML5 Game

When you're writing loops and conditions, things can go pretty badly in your HTML game code and a debugger may be necessary. Sometimes it's very hard to tell what exactly is going on. Fortunately, modern [more…]

How to Send Data To and From Functions in Your HTML5 Game

Functions make your HTML5 game code safe because variables created inside a function are destroyed when the function dies. Sometimes, though, you want data to move from one function to another. One solution [more…]

How to Use Arrays to Simplify Data in Your HTML5 Game

HTML5 games are about data; often that means a lot of data. An array is the most basic tool programmers have for managing large amounts of data. JavaScript supports a simple yet very powerful and flexible [more…]

How to Create Random Numbers in Your HTML5 Game

Random numbers are a key part of HTML5 game programming. Often you want some kind of random behavior. This is used to mimic the complexity and unpredictability of the universe. Most languages have a random [more…]

How to Build the Number Guesser in Your HTML5 Game

With random numbers, you can make interesting HTML5 games. Take a look at a simple game that uses HTML, CSS, and JavaScript together. This game has a number of interesting features: [more…]

How to Write the CSS for the Number Guesser in Your HTML5 Game

The HTML provides the foundation for the number guesser in your HTML5 game, but it needs some CSS code to make it have the look you're aiming for. The CSS isn't just for beauty's sake, but it also adds [more…]

How to Respond to a Button in Your HTML5 Game

As in most HTML games, the real action happens when the user clicks a button. This form has two buttons, but one of them is hidden most of the time. For now, concentrate on the code that happens when the [more…]

How to Build Animation with simpleGame.js Your HTML5 Game

It's possible to build a library that simplifies all of the various HTML5 game engine features. Consider using the library: simpleGame.js. This library is easy to use and is fully capable of sophisticated [more…]

How to Create User Interaction in Your HTML5 Game

The biggest difference between an HTML5 game and an animation is user interaction. If you want to make it a game, you need the user to get involved. And here’s how to do that. [more…]

How to Build Sprite Objects for Your HTML5 Game

To make very powerful HTML5 games, you'll want to be able to build your own sprites that do exactly what you want them to do. After you make an object, you can give it characteristics and behavior. [more…]

How to Add Properties to Objects in Your HTML5 Game

One of the most interesting things about HTML game objects is that they are variables that can contain other variables. When a variable exists in the context of an object, the variable is called a [more…]

How to Add Methods to Classes in Your HTML5 Game

Properties describe the characteristics of an object in your HTML 5 game, and methods describe the behavior. A method is a function associated with an object. You build methods very much like creating [more…]

How to Add Sound to Your HTML5 Game

Sound effects have long been one of the biggest weaknesses of the web as an HTML gaming platform. Web browsers had very inconsistent and troublesome audio capabilities. Fortunately, HTML5 solves the sound [more…]

How to Add Collisions to Your HTML5 Game

The most interesting things in HTML5 video games happen when sprites conk and collide into each other. Game engines normally have some sort of tool for testing whether two sprites are overlapping. This [more…]

How to Add Timing to Your HTML5 Game

Often the passage of time will be an element in your HTML5 games. Racing games are all about speed, or you may have a time limit for performing some task. The [more…]

How to Plan Your HTML5 Game

The first part of HTML5 game creation is planning. It's pretty hard to program a game in the best of circumstances, and it's nearly impossible if you don't know exactly what you're trying to accomplish [more…]

How to Build a Library of Reusable Objects for Your HTML5 Game

There will be times when you will reuse objects multiple times in your HTML5 games and they're going to stay about the same. So, it makes sense to put them in a library for easy reuse. That's exactly what [more…]

How to Use the Reset Method for Your HTML5 Game

When two objects collide in your HTML5 game, it often means something important. This is where the reset method comes in. You'll often want to change the score, play a sound, reduce the number of lives [more…]

How to Work with Multiple Objects in Your HTML5 Game

It would be nice to have more than one object in your HTML5 game. Multiple objects make the game a bit more exciting and adds some depth. One object bumping around by itself isn’t much fun. What good are [more…]

How to Reset Your HTML5 Game

Of course, if your HTML5 game can stop, you need a way to restart it. The easiest way is to use a dirty trick. Because the game is in a web page, all you have to do is refresh the web page in the browser [more…]

How to Add Realistic Motion to Your HTML5 Game

Take a look at space.html. This simple game provides a good example for applying realistic motion to your HTML5 game. It utilizes the control scheme made famous in the classic games [more…]

How to Add Drag Effects to Your HTML5 Game

The vector addition principle can be useful to your HTML5 game in many ways. For one, it can add drag effect and thus, lead to more accurate land-vehicle behavior. Imagine your car is stuck in a bad neighborhood [more…]

Listings:1-2526-5051-7576-100more...

Sign Up for RSS Feeds

Computers & Software
Great Gadget Giveaway -- Enter to Win!

Inside Dummies.com