Prevent thought bubbles from overlapping on spawn#32
Draft
Conversation
- Add calculateDistance helper to compute Euclidean distance between positions - Add isPositionValid helper to check for overlapping bubbles - Modify spawnBubble to try up to 20 positions before spawning - Add fallback positioning if no valid position found after max attempts - Set minimum distance threshold of 25% viewport units between bubbles - Tested manually with multiple bubbles spawning successfully without overlap Co-authored-by: Theaxiom <57013+Theaxiom@users.noreply.github.com>
Deploying criticalmassgame with
|
| Latest commit: |
d49e81c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://e5ae233d.criticalmassgame.pages.dev |
| Branch Preview URL: | https://copilot-fix-thought-bubbles-n28n.criticalmassgame.pages.dev |
- Extract magic numbers to named constants in fallback logic - Add clear comments explaining vertical staggering parameters - Remove misleading comments about old implementation - Improve readability and maintainability of collision detection code Co-authored-by: Theaxiom <57013+Theaxiom@users.noreply.github.com>
- Correct VERTICAL_RANGE calculation to produce 20-55% range (not 20-54%) - Update constant name from MAX_VERTICAL_RANGE to VERTICAL_RANGE for clarity - Simplify modulo expression for better readability - Ensure fallback positioning matches documented behavior Co-authored-by: Theaxiom <57013+Theaxiom@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix thought bubbles to prevent overlapping
Prevent thought bubbles from overlapping on spawn
Dec 27, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thought bubbles were spawning at random positions without collision detection, causing overlaps that made individual bubbles difficult to dismiss.
Changes
Added collision detection to
src/hooks/useThoughtBubbles.js:calculateDistance()- Euclidean distance between bubble positions (viewport %)isPositionValid()- Validates 25% minimum separation from existing bubblesspawnBubble()to attempt up to 20 positions before fallback to vertical staggeringResult
Bubbles maintain clear separation (25% viewport distance) for reliable tap/swipe interactions:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.