RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


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.

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.

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