FlatRedBall.Math.Geometry.AxisAlignedRectangle.CollideAgainstMoveSoft

Introduction CollideAgainstMoveSoft performs the following logic: It checks to see if two AxisAlignedRectangles are overlapping If so, it adjusts the velocity of the caller and the argument AxisAlignedRectangles according to how much the two shapes overlap each other and according to the separation velocity. Since this function adjusts the velocity of the caller and the[…]

FlatRedBall.Math.Geometry.AxisAlignedRectangle.GetRandomPositionInThis

Introduction GetRandomPositionInThis returns a Vector3 representing a random position in the calling AxisAlignedRectangle. This value can be used for any logic, such as randomly positioning an object within an AxisAlignedRectangle. Code Example The following example can be used to create 50 Circles inside an AxisAlignedRectangle. The code assumes that the rectangle is called AxisAlignedRectangleInstance and[…]

FlatRedBall.Math.Geometry.AxisAlignedRectangle.Color

Introduction The AxisAlignedRectangle object supports changing its Color property by assigning a Color value. Example The following example requires that LeftRectangle and RightRectangle are valid Rectangles. For this example the rectangles were created in Glue. The following code can be used to modify the colors of the Rectangles: LeftRectangle.Color = Microsoft.Xna.Framework.Color.Red; RightRectangle.Color = Microsoft.Xna.Framework.Color.Yellow;

FlatRedBall.Math.Geometry.AxisAlignedRectangle.KeepThisInsideOf

Introduction The KeepThisInsideOf method repositions the calling AxisAlignedRectangle (or its TopParent if it is attached to another PositionedObject) so that it is not outside of the argument AxisAlignedRectangle. This method will do a one-time re-position of the calling instance, so it must be called every frame if the moving AxisAlignedRectangle. This method can only be[…]

Left

Introduction The Left, Right, Top, and Bottom properties on AxisAlignedRectangle return the absolute position of the respective side. Code Example The following code shows how to get the four values (Left, Right, Top, and Bottom): // This assumes your rectangle is called RectangleInstance float left = RectangleInstance.Left; float right = RectangleInstance.Right; float top = RectangleInstance.Top;[…]

FlatRedBall.Math.Geometry.ShapeCollection.CollideAgainstMove

Introduction CollideAgainstMove is a function which takes any shape type (such as AxisAlignedRectangle or Circle) and calls CollideAgainstMove between the argument and all shapes contained in the ShapeCollection. This method is an alternative to writing loops for all of the contained objects and manually calling CollideAgainstMove. Using CollideAgainstMove has a number of benefits: Less code[…]

FlatRedBall.Input.IMouseOver

Introduction The IMouseOver interface is an interface that is used to standardize checks between an object and the Cursor. IsMouseOver Code Example The following code checks to see if the Cursor is over an AxisAlignedRectangle. This example was created inside an Entity which contains an AxisAlignedRectangle instance called AxisAlignedRectangleInstance: Add the following to CustomInitialize to[…]

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

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

TileShapeCollection

Introduction TileShapeCollection is a class created specifically for tile based collision. Its features include: Very fast collision – it has partitioning built-in. Eliminates snagging – Internally the TileShapeCollection modifies contained AxisAlignedRectangles’ RepositionDirections to eliminate snagging. Full support in Glue for initial definition and collision relationships. Simplified syntax – Adding collisions to TileShapeCollection is very easy[…]