Platformer.RectangleExtensions.GetBottomCenter C# (CSharp) Method

GetBottomCenter() public static method

Gets the position of the center of the bottom edge of the rectangle.
public static GetBottomCenter ( this rect ) : Vector2
rect this
return Vector2
        public static Vector2 GetBottomCenter(this Rectangle rect)
        {
            return new Vector2(rect.X + rect.Width / 2.0f, rect.Bottom);
        }

Usage Example

示例#1
0
        /// <summary>
        /// Instantiates an enemy and puts him in the level.
        /// </summary>
        private Tile LoadSpikeTile(int x, int y)
        {
            Vector2 position = RectangleExtensions.GetBottomCenter(GetBounds(x, y));

            spikes.Add(new Spike(this, position));

            return(new Tile(null, TileCollision.Passable));
        }
All Usage Examples Of Platformer.RectangleExtensions::GetBottomCenter