FabGL
ESP32 VGA Controller and Graphics Library

◆ detectCollision() [1/2]

Sprite * fabgl::CollisionDetector::detectCollision ( Sprite sprite,
bool  removeCollidingSprites = true 
)

Detect first collision with the specified sprite.

It is necessary to call CollisionDetector.update() before detectCollision() so sprites position and size are correctly updated.

Parameters
spriteThe sprite to detect collision.
removeCollidingSpritesIf true the collided sprites are automatically removed from the collision detector.
Returns
The other sprite that collided with the specified sprite.