FlatRedBallXna:Tutorials:Clipping Sprites

Introduction Clipping is the process of removing part of a Sprite from being rendered by defining a rectangular area which will contain the Sprite. This tutorial will show you how to write code to clip Sprites within a rectangle. This form of clipping has some requirements: The Sprite being clipped must not be rotated The[…]


Introduction The ConvertToZBufferedSprite method can be used on Sprites which have already been added to the SpriteManager as ordered (not z-buffered). This method assumes: That the argument Sprite has already been added to the SpriteManager That the Sprite is not on a Layer Code Example The following code adds a Sprite regularly, then converts it[…]


Introduction The Sprites member in a Scene provides access to the contained Sprites. Accessing the Sprites You can simply loop through the Sprites to make changes. For example, the following code sets all contained Sprites’ Alpha to 0: for(int i = 0; i < SceneInstance.Sprites.Count; i++) { SceneInstance.Sprites[i].Alpha = 0; } Getting the dimensions of[…]

Glue:How To:Add a Sprite

Introduction Sprites can be added to Screens and Entities. To add a Sprite: Expand an existing Screen or Entity Right-click on the “Objects” item under the Screen or Entity Select “Add Object” Select the “FlatRedBall Type” option Select “Sprite” in the list of types Click “OK” You may also want to set the Sprite’s Texture.[…]


Introduction RemoveSprite removes a Sprite from the SpriteManager. It also removes the Sprite from any rendering that may be done by the engine (such as if the Sprite is part of a Layer. This method can be called on any Sprite regardless of whether it belongs to a particular Layer, whether it is automatically or[…]


Introduction The AutomaticallyUpdatedSprites property in the SpriteManager is a list of all Sprites which the SpriteManager will apply standard behavior to. This includes velocity, rotational velocity, attachment, color rate changes, scale velocity, and animation. This list is made available for debugging and testing. It can be added to a watch window when Visual Studio has[…]


Introduction The SpriteSave class is the “save” class for the Sprite object. The SpriteSave class is usually associated with the SpriteEditorScene class (SpriteEditorScene contains a list of SpriteSaves). The SpriteSave class is a useful class if you plan on manually loading or saving .scnx files. Code Example The SpriteSave is a “save” class which means[…]


Introduction The AddParticleSprite returns a Sprite from the SpriteManager’s internal particle pool. AddParticleSprite is internally used in the Emitter’s Emit method, but can also be used if your game needs to create Sprites but you do not want to incur memory allocation during runtime.