CheckTileCollisionIntersect() public method

public CheckTileCollisionIntersect ( Vector2 position, Rectangle rect ) : Rectangle?
position Vector2
rect Microsoft.Xna.Framework.Rectangle
return Rectangle?
Beispiel #1
0
        Rectangle? CheckCollisionTop(Map gameMap)
        {
            for (float x = collisionRect.Left+5; x < collisionRect.Right-5; x += 1)
            {
                Vector2 checkPos = new Vector2(x, collisionRect.Top);
                Rectangle? collRect = gameMap.CheckTileCollisionIntersect(checkPos, collisionRect, Layer);
                if (collRect.HasValue) return collRect;
            }

            return null;
        }
Beispiel #2
0
        Rectangle? CheckCollisionRight(Map gameMap)
        {
            for (float y = collisionRect.Top; y < collisionRect.Bottom; y += 1)
            {
                Vector2 checkPos = new Vector2(collisionRect.Right, y);
                Rectangle? collRect = gameMap.CheckTileCollisionIntersect(checkPos, collisionRect, Layer);
                if (collRect.HasValue) return collRect;
            }

            return null;
        }