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.
For information about how to use Sprites in the FlatRedBall Editor, see the Sprite FlatRedBall page.
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.
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 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:
Sprite newSprite = SpriteManager.AddParticleSprite();
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.
- FlatRedBall.Graphics.Animation.IAnimationChainAnimatable – Interface defining animation properties and methods. See this entry for information on animating Sprites.
- FlatRedBall.Graphics.IColorable – Information on setting individual color values and the ColorOperation property.
- Custom Sprite Effects – Can be used for special rendering needs.
- FlatRedBall.SpriteManager.OrderedSortType – Property that controls how Sprites are sorted.
- Inheriting from Sprite
- Sorting and Overlapping
- Changing a Sprite’s Origin