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[…]


Introduction ScalePositionsAndScales will scale an entire Scene’s position and scale values by an argument amount. Code Example The following code would make a Scene 2x as large in every direction: // Assuming SceneInstance is a valid Scene: SceneInstance.ScalePositionsAndScales(2.0f);


Introduction ManualDeserialization is a static field on Scene which determines if the engine should use the default XML deserializers, or if it should use an internal deserialization method where it destructs the XML and assigns the properties based off of string values. The default XML deserialization (when ManualDeserialization is false) uses reflection to deserialize .scnx[…]


Introduction The RemoveFromManagers method will remove all contained objects from their respective FlatRedBall managers. Calling this method will result in all contained objects no longer being rendered and no longer being updated. RemoveFromManagers will also clear out the Scene. Preventing clearing the Scene If you do not want the Scene to be cleared when calling[…]


Introduction The MakeOneWay method is a method which modifies all contained objects in the Scene so that they no longer are aware that they are part of the Scene. In other words, this breaks two-way relationships between the Scene and its contained objects.


Introduction The Shift method is a method which can be used to move an entire Scene by the argument shiftVector. This method will work on all contained objects including SpriteGrids. Code Example The following code shifts a scene 3 units on the X axis and 4 units on the Y axis: Vector3 shiftVector = new[…]


Introduction This method converts all contained Sprites and PositionedModels to be manually-updated. This can be used to greatly improve performance of your game if your Scene does not have any kind of every-frame activity such as velocity, color rates, or attachments. This method can be called after the Scene is added to managers using AddToManagers.


Back to Scene Introduction The ManageAll method calls the Manage method on all contained SpriteGrids. If there are no SpriteGrids contained in the Scene, then this method does nothing. In most cases if your Scene contains SpriteGrids you should call ManageAll. If not, you may have bugs where SpriteGrids seem to be missing Sprites when[…]

FlatRedBall.Scene:Setting Camera

Introduction If you have worked with the SpriteEditor then you may have noticed that Scenes in the SpriteEditor may not look the same in your game as they do in the SpriteEditor. This is usually the case if you have moved the Camera in the SpriteEditor scene or if you have re-sized the SpriteEditor window.[…]


Introduction The AddToManagers method adds all contained elements in the calling Scene to their appropriate managers. Since a Scene can contain Sprites, Text objects, and PositionedModels, this method can add objects to more than one manager. This method is most often called after a Scene is loaded through FlatRedBallServices. Method Signatures public void AddToManagers() Adds[…]