A sprite is a 2D image used to represent game characters in a video game. Most game programming languages make a distinction between images and sprites.
Images are single images while sprites consist of several images to give it animation. Also, most game programming languages require that you load a picture as an image first and then assign it as a sprite and feature collision detection functions for sprites.
Sprites in Game Programming
Loading Sprites
Most game programming languages have a function to load sprites. The function returns a number (often called the sprite index) which is used to refer to the sprite. The sprite index is usually stored in a variable immediately after a sprite is loaded.
Displaying Sprites
Most game programming languages have a function to draw sprites.
Changing Sprites
To change the sprite displayed for something, simply change the index of the sprite you are drawing.
3D Sprites
There is no such thing as a "3D sprite". These are called 3D models. Sprite is a term specifically used to refer to a 2D animated image. While a sprite can be used in a 3D game, it remains flat in the 3D space, like a piece of paper..
Isometric Sprites
Isometric sprites have the appearance of being 3D.
- See Isometric Sprites at the Game Sprites Wiki
Sprite Sheet
A sprite sheet is a single image (usually .png) that contains frames of one sprite or several sprites. While sprite sheets are a convenient way to download a set of sprites quickly, they are very rarely ever formatted to be directly imported into a game.
Related Pages
Links
- Game Sprites Wiki project - learn to make sprites, get free sprites.
- Sprite page of the Game Maker Wiki
- Sprite page of the PlayBasic Wiki
To Do
- Change the sprite of an instance
- For 4 directions
- For 8 directions
- For platform games
- During jump sequence / going up / coming down
- Load a sprite from file during runtime
- Notes about instances and "current" sprites
- Problem : how to stop the animation of a sprite drawn by draw_sprite() (note image_index -1)
- Draw a sprite at a depth.
- Make sprite face mouse / another sprite
- Lighting from behind / block of color
- Set sprites in background during runtime
- Rain, snow, sleet and other "sprite-particle" based effects
- Graphics filters, like bevel and grayscale.
| Categories: Game Programming : Graphics |