Skip to content

Fix #15 #17 #23: Tab focus pause + Score save + Lives negative#31

Open
HuiNeng6 wants to merge 2 commits into
woydarko:mainfrom
HuiNeng6:fix-bugs-15-17-23
Open

Fix #15 #17 #23: Tab focus pause + Score save + Lives negative#31
HuiNeng6 wants to merge 2 commits into
woydarko:mainfrom
HuiNeng6:fix-bugs-15-17-23

Conversation

@HuiNeng6
Copy link
Copy Markdown

Bug Fixes

Fix #15: Pause game when tab loses focus

  • Added visibilitychange listener to pause/resume game loop
  • Pauses pest spawning, BGM, and game timer when tab hidden
  • Resumes correctly based on current stage

Fix #17: Save score to localStorage on game over

  • High score persisted to localStorage
  • Displays both current score and high score on end screen

Fix #23: Prevent lives counter going negative

  • Changed forEach to reverse for loop with early break
  • Stops pest processing immediately when hp <= 0

Wallet for Bounty: TRcKoDSesu9W1FoEbZJWz5AiyPLTr5C6JB

Fix woydarko#25: Scale pest speed with currentStage

- Bug woydarko#24: The boss defeat check was duplicated, causing score +200 instead of +100
- Bug woydarko#25: Pest speed now scales with currentStage for progressive difficulty

Wallet for bounty payout: TRcKoDSesu9W1FoEbZJWz5AiyPLTr5C6JB (USDT TRC20)
Fix woydarko#17: Save score to localStorage on game over
Fix woydarko#23: Prevent lives counter going negative

- woydarko#15: Added visibilitychange listener to pause/resume game
- woydarko#17: Added localStorage persistence for high score
- woydarko#23: Changed forEach to for loop with early break on hp <= 0

Wallet for bounty: TRcKoDSesu9W1FoEbZJWz5AiyPLTr5C6JB
@HuiNeng6
Copy link
Copy Markdown
Author

Hi @woydarko! This PR fixes 3 more bugs from your Scarab Bug Bounty list:

#15 - Game pauses correctly when tab loses focus (visibilitychange API)
#17 - High score saved to localStorage on game over
#23 - Lives counter no longer goes negative (early break on hp <= 0)

All fixes tested and verified in the codebase. Ready for review and merge!

Wallet for bounty payment: TRcKoDSesu9W1FoEbZJWz5AiyPLTr5C6JB (USDT TRC20)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant