Skip to content

Missing physical collision detection and randomized health drain #148

@MuganSama

Description

@MuganSama

Bug Report

Building: Arcade House
Difficulty: Hard

What is broken?

The mini-game features no actual collision detection. The player sprite can pass directly through enemy blocks without taking damage, yet the player's health steadily decreases over time regardless of their actions.

Steps to reproduce

  1. Navigate to the Arcade House and begin the Glitch Racer game.
  2. Intentionally collide with an incoming enemy block. Observe that no damage is taken upon impact.
  3. Successfully jump over all blocks and avoid all contact. Observe that health randomly drops anyway.

Expected behavior

The game should evaluate physical overlap between the player sprite and enemy sprites. Health should only decrease when a physical collision occurs on the screen.

Actual behavior

The enemy blocks were entirely CSS-driven visual decorations decoupled from React state. Instead of implementing hitboxes, the developer simulated difficulty by placing a Math.random() > 0.84 probability check inside the 900ms passive game loop, arbitrarily deducting health points regardless of gameplay.

Root cause & Fix

Root Cause: Complete absence of a 2D collision detection loop bridging DOM rendering with React state logic.
Fix applied: 1. Attached useRef hooks (playerRef, enemyARef, enemyBRef) to the respective DOM elements.
2. Removed the randomized health penalty from the passive game ticker.
3. Implemented a dedicated 50ms interval physicsEngine that evaluates getBoundingClientRect() for the elements, applying standard AABB (Axis-Aligned Bounding Box) collision math to deduct health only upon physical DOM overlap.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions