Introduction PositionedObjectLists in Glue represent lists of objects which can be positioned. Positioned objects include: Any Entity Circles AxisAlignedRectangles Texts Sprites In code all of the objects mentioned above inherit from the FlatRedBall.PositionedObject class. The list above is just some of the most common types. Creating a PositionedObjectList Entity lists can be created by right-click[…]
Introduction The ManagedPositionedObject list in the SpriteManager object is a list of PositionedObjects which the SpriteManager is managing. In a typical project (using Glue), this list will contain mostly instances of Entities in your game, so you can look at this list to see what is actively managed.
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> circleList =
// Let's create 3 Circles. Their X values will
// be in decreasing order
Circle first = new Circle();
first.X = 10;
Circle second = new Circle();
second.X = 8;
Circle third = new Circle();
third.X = 6;
// Now let's sort them:
// Now let's print out the values:
foreach(Circle circle in circleList)
Introduction The Clear function is a function that will empty a PositionedObjectList of all contained references – it operates the same way as calling Clear on a normal List. However, although Clear is a very common function when dealing with regular Lists, it is not often used on PositionedObjectLists. If you are using Clear, make[…]
Introduction The LastPosition property is a protected property which marks the position of the PositionedObject last frame. This property is only updated if the PositionedObject’s KeepTrackOfReal.
Introduction The PositionedObject’s Velocity and Acceleration values often dictate the position and movement of a PositionedObject, but sometimes these properties are also used in game code to control other objects. For example, in a physically realistic game if an airplane is flying at a certain speed and fires a bullet, the bullet’s world velocity should[…]
Introduction The AddPositionedObject method is a method which adds an existing PositionedObject instance to the SpriteManager for management. Managed PositionedObjects will have velocity, acceleration, drag, and attachment properties applied automatically every frame. This method should only be called for objects which are otherwise not handled specifically by the FlatRedBall Engine. For example, Sprites are managed[…]
Introduction UpdateDependencies is a method which updates absolute values (specifically position and rotation) according to the caller’s relative values and Parent absolute values. The UpdateDependencies method is a method which is automatically called by the Engine on any PositionedObject or PositionedObject-inheriting object which is part of a FlatRedBall manager. In most cases you will never[…]
Introduction The Add method adds the argument PositionedObject to the PositionedObjectList. The argument object will create a two-way relationship with the list. Null arguments are not allowed.
Introduction Position is a variable which controls a PositionedObject’s absolute position. The PositionedObject is a Vector3, meaning PositionedObjects can be controlled on the X, Y, and Z axes. Position is a value which controls and returns the absolute position of a PositionedObject. Position and X,Y,Z properties The Position variable is a “mirror” variable for the[…]