Skip to content

Player lives counter displays negative values when multiple pests reach the end simultaneously #23

Description

@woydarko

Bug Description

When two or more pests reach the end of the path at the exact same frame, the lives counter decrements multiple times simultaneously, causing it to display negative values like -1 or -2 instead of triggering game over at 0.

Steps to Reproduce

  1. Start the game on any stage
  2. Let two pests reach the end at the same time (easier on higher stages with faster pest speed)
  3. Observe the lives counter in the UI

Expected Behavior

When lives reach 0, the game over screen should trigger immediately. The lives counter should never go below 0.

Actual Behavior

Lives counter shows -1 or -2. Game over condition is not triggered because the check likely compares lives === 0 instead of lives <= 0, so negative values bypass the game over state entirely.

Root Cause (suspected)

In script.js, the lives decrement and game over check likely runs as:

lives--;
if (lives === 0) gameOver();

Instead of:

lives--;
if (lives <= 0) gameOver();

Environment

  • Chrome 122 / Firefox 124
  • Windows 10 / macOS

Wallet: 0x964739472C587d24934c37BEbB405CeE36D59B24

Metadata

Metadata

Assignees

No one assigned

    Labels

    bounty-invalidBug report rejected by Scarab AI

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions