Account Settings
FIRST NAME
[Loading...]
LAST NAME
[Loading...]
EMAIL
[Loading...]
ID
[Loading...] For support purposes only
Share AgencyGenius

We've listed the code documentation below, making a tool for this one is somewhat pointless as a game is somewhat subjective in what you want it to do more so than any other type of component.


We've given you the code for our version and encourage you to input into your AI platform to change colours and such but our hope is that you have a bit of fun with it. It is a gimmick after all. We look forward to seeing what other games you create.


404 Gravity Drop Game Overview

The 404 Gravity Drop Game transforms a typical error page into an interactive physics-based experience. Users click to drop balls that destroy blocks arranged in a "404" pattern, utilizing GSAP's Physics2D plugin for realistic gravity simulation and particle effects for visual feedback.

HTML Structure

The game's HTML architecture consists of:

  • A fixed wrapper container #gravity-drop-wrapper covering the entire viewport
  • Header section with logo, navigation links, and CTA button
  • Game area container .gd-game-area with data attribute data-gd-game
  • Block container .gd-block-container for the 404 pattern
  • Score display with counter elements using data-gd-count and data-gd-total
  • Hidden completion screen .gd-complete for game end state
  • Dynamic elements for balls, particles, and visual effects
Physics Implementation

The game leverages GSAP's Physics2D plugin for realistic motion:

  • External script imports: gsap@3.13.0 and Physics2DPlugin
  • Gravity setting of 800 pixels per second squared for balls
  • Particle physics with random velocity 100-400 and angles -180 to 0
  • Particle gravity of 600 for lighter falling effect
  • Ball squeeze animation using scaleY: 0.8, scaleX: 1.2
  • 5-second duration for ball physics simulation
404 Pattern Generation

The distinctive 404 block pattern is created programmatically:

  • 2D array pattern with 1 representing blocks and 0 for empty spaces
  • 5 rows by 13 columns grid structure
  • Dynamic block sizing: 18px mobile, 30px tablet, 40px desktop
  • Spacing calculation: blockSize + 3 for mobile, +4 tablet, +5 desktop
  • Center positioning using transform: translate(-50%, -50%)
  • Individual block positioning with (x * spacing - spacing * 6.5) formula
Collision Detection System

Real-time collision detection between balls and blocks:

  • getBoundingClientRect() for precise position tracking
  • AABB (Axis-Aligned Bounding Box) collision algorithm
  • Collision check formula: ballRect.left < blockRect.right && ballRect.right > blockRect.left
  • data-destroyed attribute prevents duplicate collisions
  • Continuous checking via GSAP's onUpdate callback
  • Frame-by-frame collision validation during ball movement
Visual Effects and Animations

The game features multiple layers of visual feedback:

  • Block destruction: scale: 0, rotation: random(-180, 180) with 0.4s duration
  • 8 particles per block explosion with random colors from palette
  • Click indicator animation: scale: 0.5 to 1.5 with opacity fade
  • Ball styling: radial-gradient(circle at 30% 30%, #ff69b4, #AD24A6)
  • Shadow effects: box-shadow: 0 3px 15px rgba(173, 36, 166, 0.4)
  • Hover states on blocks with transform: scale(1.05)
Combo System

Dynamic combo tracking rewards rapid block destruction:

  • Combo counter increments on each block hit
  • 300ms timeout window between hits using setTimeout
  • Combo display animation: scale: 0.5 to 1.2 with back.out(1.7) easing
  • Vertical movement: y: 0 to -30 during animation
  • Text format: ${comboCount}x COMBO!
  • Automatic fade out after display with opacity transition
Scoring and Statistics

Comprehensive game metrics tracking:

  • Total blocks counted during pattern generation
  • Destroyed blocks tracked via destroyedBlocks++
  • Ball usage counter increments on each click
  • Efficiency calculation: Math.round((totalBlocks / ballsUsed) * 100)
  • Real-time counter display updates
  • Completion screen shows final statistics
Responsive Design Implementation

The game adapts seamlessly across device sizes:

  • Breakpoints: max-width: 768px mobile, max-width: 1024px tablet
  • Dynamic block sizing based on window.innerWidth
  • Navigation links hidden on tablet and mobile via display: none
  • Header padding adjusts: 2rem 3rem desktop to 1rem 1.5rem mobile
  • Logo height scales from 40px to 30px
  • Game area height calculation: calc(100vh - 100px) to calc(100vh - 70px)
Event Handling and Interactions

User input management and interaction flow:

  • Click event listener on .gd-game-area container
  • Cursor style: cursor: crosshair for targeting feedback
  • Ball spawn position calculated from e.clientX - rect.left
  • Fixed Y spawn at 50px from top
  • Double-tap prevention: touchend event with 300ms threshold
  • e.preventDefault() blocks zoom on mobile devices
Performance Optimizations

Several techniques ensure smooth gameplay across devices:

  • Automatic element removal after animations complete
  • pointer-events: none on non-interactive elements
  • Single collision check per block using dataset.destroyed flag
  • Particle cleanup with onComplete: () => particle.remove()
  • Ball removal after 5-second physics duration
  • Efficient DOM queries using data attributes
  • Hardware-accelerated CSS transforms for animations
Game State Management

The game tracks multiple state variables:

  • totalBlocks : Initial block count from pattern
  • destroyedBlocks : Current progress counter
  • ballsUsed : Total balls dropped by player
  • comboCount : Current combo chain length
  • comboTimer : Timeout reference for combo reset
  • blocks array: References to all block elements
  • Completion trigger when destroyedBlocks === totalBlocks
Video Thumbnail

How to edit code using AI

Resource Details:
404 Game transforms the frustration of landing on a broken link into an engaging mini-game experience that keeps visitors on your site. Instead of losing users to a standard error page, entertain them with interactive games ranging from simple click adventures to retro arcade classics, turning a potential bounce into extended engagement. While it's admittedly a playful gimmick, these unexpected moments of fun create memorable brand experiences and give users a reason to explore more of your site. Includes high score tracking, customizable game themes, and easy integration with fallback navigation options.

Last Updated:

June 17th 2025

Category:

Gimmick

Need Help?

Join Slack

Callum Wells
Callum Wells
i
Creator Credits
We always strive to credit creators as accurately as possible. While similar concepts might appear online, we aim to provide proper and respectful attribution.
A black padlock with a keyhole on a white background.

NO-ACCESS

Only for Desktop Users

This page is only available on desktop.

Please Log in on a desktop to gain access.