The Math Behind Game Collisions @Frankslaboratory
The Math Behind Game Collisions  @Frankslaboratory
Uploaded May 2026 | Updated September 2026, 1 week ago
What is one of the most useful pieces of MATH every game developer should know? The Pythagorean theorem! Let’s use it to detect collisions. In this episode, we build a fully animated HUD and layered health bar, create a reusable collision system, and allow player to be damaged using event-driven logic. Let's make web games with vanilla JavaScript!

You’ll learn:
How to build an animated health bar with CSS variables
Event-driven game architecture using emitters
Circle-vs-circle collision detection
Why squared distance checks are faster than using square roots
Data-driven asset loading with map() and Object.values()
How CollisionManager and CollisionSystem work together
How to keep game.js clean and modular
Better ways to structure larger JavaScript game projects

This is part of a full vanilla JavaScript game development series, where we’re building a reusable starter kit step by step: youtube.com/playlist?list=PLYElE_rzEw_tjnJ_5gzRw0ZM5HRn7AIS0&si=j53kz7v7JoN5dg1B

Resources:
Source code: code-laboratory.kit.com/f08d3d0aa8
Audio:
🎵 player_hurt.mp3: frankslaboratory.co.uk/downloads/147/player_hurt.mp3
🎵 game_over.mp3: frankslaboratory.co.uk/downloads/147/game_over.mp3
🎵 mission_complete.mp3: frankslaboratory.co.uk/downloads/147/mission_complete.mp3

⏱ Timestamps
00:00 The Most Important Formula in 2D Game Dev
01:24 Source Code Checkpoint (P16)
04:04 Choosing Our Next Game System
09:30 Data-Driven Audio Loading
12:26 Data-Driven Image Loading
15:55 Source Code Checkpoint (P17)
16:26 Building a Reusable Collision System
20:47 Adding Player Health and Damage
23:57 Collision Manager and Events
32:40 Updating the Health Bar with Events

Tiny details like hit reactions, UI animation, and sound feedback completely change how a game feels. Most games are really just layers of systems constantly communicating with each other in real time, so let’s learn how to build a flexible, reusable collision system for our 2D games.

This class is for beginners and intermediate developers interested in JavaScript game development, 2D game programming, and game architecture design. Whether you're building a top-down shooter, roguelike, survival game, or browser-based HTML5 canvas game, these techniques will help you create cleaner systems, better game feel, and more scalable code. We’ll work with vanilla JavaScript, object-oriented programming, collision detection algorithms, event-driven systems, reusable managers, and responsive UI effects commonly used in real game development workflows.

If you want more videos like this, don’t forget to like and subscribe!
#JavaScriptGameDevelopment #VanillaJavaScript #HTML5Canvas #frankslaboratory
The Math Behind Game CollisionsWhat are flow fields #SHORTSDrawing Star Wars Droid With CSS - Animated Background Tutorial, CSS3 Web Design Ideas For BeginnersJavaScript Flappy Bird with Particles & SpritesNext Level Vanilla JavaScript UI AnimationsCSS Filters - SVG Turbulence Filter Animation [ CSS3 Creative Menu Hover Effects ] SquigglevisionCSS Login Form Animation With Wave Placeholder Text Effect - CSS3 & HTML5 Tutorial for BeginnersJavaScript Game Tutorial - Many Different EnemiesAnimated CSS Button Hover Tutorial | SVG Icons Drawing EffectJavaScript Game Tutorial - 2D Tower Defense PART 2JavaScript project tutorial for beginners [HTML Canvas Particles]JavaScript RETRO Games: Super Weapons
Franks laboratory |

The Math Behind Game Collisions

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER