AudioAsset
Ease
FastString
FontAsset
NineSlice
PackedSprite
PackedSpriteID
RB
   HardwareSettings
   IRetroBlitGame
RBAsset
Rect2i
ShaderAsset
SoundReference
SpriteGrid
SpriteSheetAsset
TMXMapAsset
   TMXLayer
   TMXLayerLoadState
   TMXObject
   TMXObjectGroup
   TMXProperties
Vector2i

Rect2i.Intersects

Method

public bool Intersects(Rect2i rect)

Parameters

rect Rect2i Other rectangle

Returns

bool

True if there is an intersection, false otherwise.

Description

Checks if there is an intersections with another rectangle.

Example

void Update() {
    // Check for intersection, and resolve.
    if (playerRect.Intersects(blockRect)) {
        var depth = playerRect.IntersectionDepth(blockRect);
        playerRect.x += (int)depth.x;
        playerRect.y += (int)depth.y;
    }
}

See Also

Rect2i.IntersectionDepth
Rect2i.Intersect
Rect2i.Contains