← Back to Documentation Index

💥 Collision Detection

AABB, circle, and tilemap collision detection utilities

📋 Overview

The Collision Detection system provides fast and accurate collision checking for boxes (AABB), circles, and tile-based maps.

💡 Collision Types
  • AABB - Axis-Aligned Bounding Box (rectangles)
  • Circle - Circular collision detection
  • Tilemap - Grid-based collision for platformers
  • Raycasting - Line-of-sight checks

💥 Collision Functions

checkAABB(box1, box2)

Checks if two axis-aligned boxes overlap.

box1 object {x, y, width, height} - First box
box2 object {x, y, width, height} - Second box
Returns: boolean - true if boxes overlap
Example:
if (checkAABB(player, enemy)) { /* collision! */ }
checkCircle(circle1, circle2)

Checks if two circles overlap.

circle1 object {x, y, radius} - First circle
circle2 object {x, y, radius} - Second circle
Returns: boolean - true if circles overlap
Example:
if (checkCircle(ball, hole)) { /* scored! */ }