AutomaticallyUpdatedSprites

Introduction

Adding and Removing from AutomaticallyUpdatedSprites

AutomaticallyUpdatedSprites is a SpriteList which is exposed for debugging, tools development, and advanced FlatRedBall programming. Most games do not need to add or remove Sprites directly from this list. This list is added to and removed from using more common FlatRedBall methods.

Adding to AutomaticallyUpdatedSprites

AutomaticallyUpdatedSprites gets populated whenever a Sprite is added through the SpriteManager. For example:

SpriteManager.AddSprite("redball.bmp"); // Instantiates a Sprite and adds it to AutomaticallyUpdatedSprites

Adding existing instances also adds the Sprite to AutomaticallyUpdatedSprites:

Sprite sprite = new Sprite();
SpriteManager.AddSprite(sprite);

Also adding a Sprite to a Layer will add it to AutomaticallyUpdatedSprites:

// assuming mySprite and myLayer are valid:
SpriteManager.AddToLayer(mySprite, myLayer);

Removing from AutomaticallyUpdatedSprites

AutomaticallyUpdatedSprites is a SpriteList which means it inherits from PositionedObjectList so it shares a two-way relationship with any Sprite that is added to it. Calling SpriteManager.RemoveSprite is the recommended way of removing a Sprite from this List.

Last updated