Chapter 4Creating a Sprite-Based Game

Many video games—from old classics such as Asteroids and Pac-Man, to modern mobile games such as Flappy Bird and Temple Run—are made using sprites. Sprite is a term that dates back to 1970s video game systems like the Atari. It refers to a small image that moves around inside a scene. In a single game there can be many sprites; often one sprite is controlled by the player, and others are controlled by the program.

We’re going to make our own sprite-based game called Sector Five, in which the player moves a spaceship around the screen by pressing keys. Waves of enemy ships descend from above, and the player needs to shoot them before they get to the bottom of the screen and destroy the player’s base. When ...

Get Learn Game Programming with Ruby now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.