Skip to content

Instantly share code, notes, and snippets.

View sid-gh900's full-sized avatar

siddharth-gh-newbie sid-gh900

  • Joined Apr 26, 2026
View GitHub Profile
You want to share the core collision logic so other developers can use it in their own games.
/**
* Global Helper for Block Buster Game
* Logic to detect if the ball hits a block
*/
function checkCollision(ball, block) {
if (ball.x + ball.radius > block.x &&
ball.x - ball.radius < block.x + block.width &&
ball.y + ball.radius > block.y &&
ball.y - ball.radius < block.y + block.height) {