Created: January 2011
Last Updated: January 2011
Original Author: Tony Huynh
Overview
This section contains various important information to be aware of when using Entities.
Remarks on an Entity's Position
In FlatRedBall the Entity's position is represents the center of the entity. Therefore, it is also the center of the entity's sprite.
Destroying an Entity
Make sure to program the removal of all manually controlled objects (that belongs to the Entity) from its FlatRedBall managers in the CustomDestroy() or Destroy() method depending on whether you used Glue to create the Entity or not. See Switching Screens for the reasoning behind this.
The List Container - PositionedObjectList
The PositionedObjectList is a useful container for managing a list of Entities. When the Entity is destroyed (i.e. its Destroy() method is called), then it will be automatically removed from the PositionedObjectList; this is possible because whenever an Entity is added to a PositionedObjectList, the Entity keeps a reference to the PositionedObjectList.