An Introduction to Game Programming with JavaScript

Some fundamental principles apply to game programming regardless of the language you use to create the game. These principles include gathering input from users, processing game data, and rendering game objects to the screen. This article shows you how to use JavaScript to program a simple game.

WEBINAR:

On-Demand

ost game programs follow the same recipethe game must gather input from the user, process that input and any other data, and render objects to the screen. Usually, the program creates event handlers that listen for user input via the mouse, keyboard, or other input device, and a game loop that manages data processing and rendering the display. Once launched, the game loop continues until it encounters some end condition.

In this article, I'll create a simple demo called Rebound that should get you started with game programming in JavaScript. Rebound is a simple ball and paddle game where the user controls a paddle with the keyboard and must keep a moving ball from getting beyond the paddle. You can view the demo here.

How do you create JavaScript Game Programs?

Use keyboard events to gather input from users and animation techniques to create games in JavaScript.

Advertiser Disclosure:
Some of the products that appear on this site are from companies from which QuinStreet receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. QuinStreet does not include all companies or all types of products available in the marketplace.

Thanks for your registration, follow us on our social networks to keep up-to-date