FlatRedBall.Math.Geometry.Circle.CollideAgainst

Introduction The CollideAgainst function is a function which returns whether one shape/ShapeCollection is touching another shape/ShapeCollection. CollideAgainst does not modify the positions or velocities of either of the callers, it simply returns true/false. Common Usage CollideAgainst is often used in the following situations: Damage-dealing collision such as a player entity vs. a bullet entity. Game[…]

FlatRedBall.Math.Geometry.Circle.Visible

Introduction The Visible property on a Circle controls whether the Circle is rendered or not. Invisible Circles will still perform collision properly, so this property does not need to be set if using Circles purely for collision. Rendered circles will render their outline using their Color property. Circles cannot be filled-in, only their outline will[…]

FlatRedBall.Math.Geometry.Circle.IsPointInside

Introduction The IsPointInside method returns whether the argument X,Y are inside the Circle. The X and Y values are absolute values. Code Example The following shows how to check if the Cursor is inside a Circle instance: float worldX = GuiManager.Cursor.WorldXAt(0); float worldY = GuiManager.Cursor.WorldYAt(0); bool isInside = CircleInstance.IsPointInside(worldX, worldY);

ICollidable

Introduction The ICollidable interface provides a standard collision implementation. Objects which implement ICollidable can collide with all FlatRedBall shapes and other ICollidables. The ICollidable interface requires a ShapeCollection property named Collision. FlatRedBall also offers the following extension methods for ICollidable: CollideAgainst – Simply returns true/false to indicate whether a collision has occured CollideAgainstMove – Returns[…]

FlatRedBall.Math.PositionedObjectList.SortXInsertionAscending

Introduction The SortXInsertionAscending (and SortYInsertionAscending/SortZInsertionAscending) function can be used to sort all contained PositionedObjects in a list by their X (or Y/Z) value. Code Example The following code creates 3 Circles and places them in a PositionedObjectList in descending X order. Then SortXInsertionAscending is called, and the positions of the Circles are printed out: FlatRedBall.Math.PositionedObjectList<Circle>[…]

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