FlatRedBall.Math.Geometry.ShapeCollection.Visible

Introduction The Visible property allows setting the visibility of all contained shapes in a ShapeCollection. It’s important to note that the ShapeCollection does not itself store any visibility data, so there is no getter for Visible. The Visible setter loops through all contained shapes and sets their Visible property accordingly. Code Example The following code[…]

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.Math.Geometry.ShapeCollection.AxisAlignedRectangles

Introduction The AxisAlignedRectangles property is a property of type PositionedObjectList. Therefore, you can use this member the same way you would use a PositionedObjectList<AxisAlignedRectangle>. Code Example The following shows how to loop through all rectangles in a ShapeCollection and perform collision between the rectangles and a Circle named CircleInstance: for(int i = 0; i <[…]

FlatRedBall.Math.Geometry.ShapeCollection.LastCollisionAxisAlignedRectangles

Introduction The LastCollision properties in the ShapeCollection can be used to identify which shapes were collided with on the last collision. This is useful because many games need to know specifically which shapes were collided against to perform custom logic. For example, you may be working on a platformer which includes collision shapes representing spikes.[…]

FlatRedBall.Math.Geometry.ShapeCollection.CollideAgainstBounceWithoutSnag

Introduction The ShapeCollection provides a CollideAgainstBounceWithoutSnag method which tests if any shape contained in the calling ShapeCollection collides the argument shape and moves the argument shape accordingly while also adjusting velocity. The “WithoutSnag” portion of the method name indicates that the method will attempt to perform the collision such that snagging will not occur. In[…]

FlatRedBall.Math.Geometry.ShapeCollection.CollideAgainstMoveWithoutSnag

Introduction The ShapeCollection provides a CollideAgainstMoveWithoutSnag method which tests if any shape contained in the calling ShapeCollection collides the argument shape and moves the argument shape accordingly. This method is different from CollideAgainstMove where CollideAgainstMoveWithoutSnag is an order independent operation where CollideAgainstMove is a order dependent operation. CollideAgainstMoveWithouSnag may be slightly slower than CollideAgainstMove and[…]

FlatRedBall.Math.Geometry.ShapeCollection.AttachTo

Introduction The AttachTo method is a shortcut method which can be used to attach all contained shapes to the argument object. In other words, the following two blocks of code are identical: someShapeCollection.AttachTo(newParent, false); and someShapeCollection.AxisAlignedRectangles.AttachTo(newParent, changeRelative); someShapeCollection.Circles.AttachTo(newParent, changeRelative); someShapeCollection.Polygons.AttachTo(newParent, changeRelative); someShapeCollection.Lines.AttachTo(newParent, changeRelative); someShapeCollection.Spheres.AttachTo(newParent, changeRelative); someShapeCollection.AxisAlignedCubes.AttachTo(newParent, changeRelative); someShapeCollection.Capsule2Ds.AttachTo(newParent, changeRelative); Newly-added Shapes must be manually attached[…]

FlatRedBall.Math.Geometry.ShapeCollection.SortAscending

Introduction The SortAscending method sorts all contained elements in the ShapeCollection by their position values on the given axis. In other words, if this method is called with an argument of Axis.X, then all contained shapes will be sorted so that their X values are increasing. The sort uses a stable insertion sort making it[…]

FlatRedBall.Math.Geometry.ShapeCollection.CollideAgainst

Introduction The ShapeCollection provides a CollideAgainst method which tests if any shape contained in the calling ShapeCollection collides the argument shape. The CollideAgainst method can also be called to test if two ShapeCollections have any shapes that collide between the two. Arguments The CollideAgainst method can be used to test collision against argument shapes. At[…]

Checkpoint and Level End

Introduction This walkthrough covers concepts related to creating an end-of-level entity which moves the player to the next level and creating a checkpoint which lets the player start at a midpoint in a level after dying. The sample project can be downloaded from GitHub: https://github.com/vchelaru/FlatRedBall/tree/NetStandard/Samples/Platformer/CheckpointAndLevelEndDemo This walkthrough refers to CheckpointAndEndLevelDemo as the demo and this demo. Main[…]