Creating Runtime Objects as Instances

Introduction Objects can be instantiated directly inside the Objects folder of Screens or Entities. Typically these instances are of standard types such as Sprite or TileShapeCollection. Also, the type of instances can be entity types, such as an instance of a Player in the GameScreen. If your game includes a special type which is not[…]

ConvertToAutomaticallyUpdated

Introduction ConvertToAutomaticallyUpdated can be used to convert an object back to an automatically updated object. This is useful for objects which typically do not move (so they shouldn’t be automatically updated), but which may move from time to time. ConvertToAutomaticallyUpdated can be called on Sprites and PositionedObject. Code Example The following shows how an entity[…]

SortTexturesSecondary

Introduction The FlatRedBall.SpriteManager method will perform a “secondary” sort of all Sprites by their Texture. The first sort condition must be Z to preserve draw order. Sprites with the same Z value will then be sorted by Texture.

RenderTargetRenderer

Introduction The RenderTargetRenderer class can be used to greatly increase the performance of FlatRedBall games which present complex scenes which never or rarely change. For static scenes a RenderTargetRenderer allows for near infinite complexity – specifically it allows for a very large number of visual elements to be drawn with almost no slowdown. Also, the[…]

Alpha

Introduction The Alpha value controls the opacity of a Sprite. A value of 1 (default) results in a fully-opaque Sprite, while a value of 0 is a fully-transparent Sprite. For more information see the Alpha property on IColorable. Sprite Alpha can be also be set in Glue directly and through states. Sprites can also be[…]

Adding WPF to an Existing Game

Introduction WPF controls can be added to any FlatRedBall PC game. This walkthrough shows how to add a floating control which will both display runtime information and also be used to add new entity instances. Setup This tutorial uses a Glue project named “FrbAndWpf” as the starting point. This Glue project will contain the following:[…]

FlatRedBall.Graphics.IVisible

Introduction The IVisible interface is an interface which defines that an object must have a Visible property. Setting Visible to true or false will make the object appear or disappear visually. Most visual FlatRedBall types implement the IVisible property including: Sprite Text AxisAlignedRectangle Circle Polygon SpriteFrame Code Example The following code shows how to toggle[…]

TextureScale

Introduction The TextureScale property can be used to size a Sprite according to its Texture and texture coordiantes. If a Sprite which is displaying its full texture is using a TextureScale of 1, then the Sprite’s width will match its Texture’s width, and the Sprite’s height will match the Texture’s Height. A TextureScale of 1[…]

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

CurrentChainName

Introduction The CurrentChainName property gets and sets the name of the AnimationChain currently played by the owner of the property. Setting this property is the most common way to change between different animations at runtime, and it can also be set in Glue to control the animation displayed by an IAnimationChainAnimatable (such as a Sprite).[…]