Skip to content

Add features, difficulty scaling, and code quality improvements#2

Open
TheSpyHead wants to merge 1 commit intoeduc8s:mainfrom
TheSpyHead:feature/my-new-improvement
Open

Add features, difficulty scaling, and code quality improvements#2
TheSpyHead wants to merge 1 commit intoeduc8s:mainfrom
TheSpyHead:feature/my-new-improvement

Conversation

@TheSpyHead
Copy link
Copy Markdown

Summary

  • High score: Saved and loaded from highscore.txt, displayed in a new panel on the right side. Updates live whenever the current score beats it.
  • Pause: Press P to pause/unpause at any time during a game.
  • Difficulty scaling: The game timer decreases by 10ms for every 500 points scored, bottoming out at 100ms (from the original fixed 200ms).
  • Constants: All magic numbers extracted to a new constants.py — screen size, offsets, timer values, panel positions, block IDs.
  • Rendering separation: Next-block preview logic moved from game.py into main.py where it belongs.
  • Crash fix: Sound file loading is now wrapped in try/except — the game starts normally even if .ogg files are missing.
  • Code cleanup: Replaced == False/== True comparisons with idiomatic not/truthiness checks; fixed mixed tab/space indentation in blocks.py.

Test plan

  • Core Gameplay: Start the game and verify normal play works.
  • Score Tracking: Score points and confirm the score display updates.
  • Persistence: Beat a previous high score and restart — confirm it persists after restart.
  • Pause Toggle: Press P mid-game and confirm blocks stop moving; press again to resume.
  • Scaling: Score 500+ points and confirm the pieces fall noticeably faster.
  • Error Handling: Remove a sound file temporarily and confirm the game still launches.
  • Edge Case: Delete highscore.txt and confirm the game creates a new one without crashing.

- Persist high score to highscore.txt across sessions
- Display high score in side panel
- Add P key to pause/unpause the game
- Increase game speed progressively with score (down to 100ms min)
- Centralize all magic numbers into constants.py
- Move next-block preview rendering from game logic to main loop
- Guard sound loading with try/except so missing files don't crash
- Fix == False / == True boolean anti-patterns throughout
- Fix mixed indentation in blocks.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant