FlatRedBall.Sprite

Introduction

The Sprite is a flat graphical object which is commonly used in 2D games as well as for particles, HUDs, and UIs in 3D games. The Sprite class inherits from the PositionedObject class.

Tutorials

Working with Sprites

Sprite Scale

For information on Scale, see the IScalable wiki entry.

To match the on-screen pixel dimensions of a Sprite to its referenced Texture’s pixel dimensions, see the 2D in FlatRedBall tutorial.

Texture

Sprites can be thought of as picture frames or canvases – they define how big a displayed image will be, its position, its rotation, and so on. However, the image or picture that they display is separate from the Sprite itself. This is an important realization because this often differs from other game engines where the image and the Sprite are one and the same at runtime.

For more information, see the Sprite.Texture page.

Color and Alpha

For information on color and alpha operations (blending), see the IColorable wiki entry.

Z Buffered Sprites

Using a Z Buffer allows Sprites to properly overlap. For more information, see the Z Buffered Sprites wiki entry.

Particle Sprites

Particle Sprites are created through the SpriteManager just like other Sprites. Particle Sprites are created from a pool of Sprites that is created when the engine is first initiated. The following code creates a particle Sprite:

Particle Sprites have all of the same functionality as regular Sprites – in fact, they are just Sprites. The only difference is that there is minimal memory allocation and garbage collection so they can be useful when creating particle effects. Particle Sprites are used by Emitters.

Interfaces

Extra Information