A sprite is a bitmap graphic that is designed to be part of a larger scene. It can either be a static image or an animated graphic. Examples of sprites include objects in 2D video games, icons that are part of an application user interface, and small images published on websites.
In the 1980s and for most of the 1990s, sprites were the standard way to integrate graphics into video games. Graphic artists created small 2D images that were used to represent characters and other objects. Developers referenced these sprites in the source code and assigned properties such as when the sprites were displayed and how they interacted with other sprites. For example, in a side-scroller, such as Super Mario Bros, the sprite of an enemy Koopa would turn into a flattened Koopa when Super Mario jumped on it. Today, some video games still use 2D sprites, but most mainstream games use 3D polygons instead. Since computers and gaming consoles now have dedicated 3D video cards, they can actually render 3D objects more efficiently than 2D sprites.
While sprites have become less common in modern video games, they are still used by software developers for other purposes. For example, sprites are often used to add buttons, symbols, and other user interface elements to software programs. Developers can attach actions to sprites within the user interface, such as playing an animation or changing the current view of the window when the sprite is clicked. Sprites are especially useful for adding custom graphics that are not natively supported by the operating system’s API.
Sprites are also used on the Web for navigation buttons and for adding visual appeal to webpages. In recent years, sprite sheets have become a popular way for web developers to load website graphics. By combining a large number of sprites into a single image, all the sprites can be downloaded and cached by a user’s browser with a single request to the server. The images are then displayed using CSS properties that define the locations of individual sprites within the image.