02 – Adding a Circle

Introduction FlatRedBall provides a number of primitives which can be used to render your game, and to perform collision. These include: Sprite – draws an image to screen. This image is often referred to as a Texture. Text – draws text to screen. Circle – draws a circle to screen and can be used for circular collision.[…]


Introduction The Circle object is commonly used for collision and as a placeholder graphic in game development. Circles can be added to entities which implement the ICollidable interface to act as the entity’s collision shape. Adding a Circle To add a circle to an existing entity: Expand the entity Right-click on the entity’s Objects folder[…]


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


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


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);


Introduction The GetPointInCircle method returns a random point inside a circle with the argument radius, centered at 0,0. This method returns an even distribution, as opposed to a “random radius, random angle” approach which returns a higher concentration of points at the center of the circle. Code example Add the following using statements: using FlatRedBall.Math;[…]


Introduction The ProjectParentVelocityOnLastMoveCollisionTangent method can be used to create realistic collisions between a Circle and any other Shape. The Circle’s version of ProjectParentVelocityOnLastMoveCollisionTangent behaves the same as the Polygon‘s version. For more information, see the Polygon’s ProjectParentVelocityOnLastMoveCollisionTangent article.


Introduction The Circle represents a PositionedObject which can be used to draw circles or conduct circular collision which is very efficient. Circles are created and removed through the ShapeManager. Creating a Circle in Glue Glue supports the creation of Circles in Screens and Entities. To create a Circle in Glue: Expand a Screen or Entity[…]