Introduction
Sprites are used to render a texture to the screen. Sprites are one of the most common types of FlatRedBall objects. Examples of Sprites include:
- Character graphics (static or animated)
- Backgrounds
- Particles
- Tile graphics
- Bullets
Creating an Entity With a Sprite
If you know that your entity needs a Sprite, you can check the Sprite option in the Add Entity Window.
- Right-click on the Entities folder
- Select Add Entity
- Check the Sprite option
- Click OK
Adding a Sprite
Sprites can be added to Glue screens or entities, although most games don’t include Sprites directly in screens.
To add a Sprite to an entity:
- Create or select an existing entity or screen
- Right-click on the Objects node
- Select Add Object
- Select the FlatRedBall or Custom Type category
- Select the Sprite type
- Click OK
Sprite Texture
Sprites usually display textures, which are created from image files such as .png files. To add and display a texture on a Sprite:
- Create a Sprite in a screen or entity as shown above
- Find a .png which you would like to use
- Drag+drop the .png file onto your screen or entity’s Files folder in Glue
- Select the Sprite in the same screen or entity with the newly-added file
- Change its Texture property to the newly-added file
For more information about working with textures, see the Texture2D page.
The Sprite will now display the texture in the preview window and in game.