-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
enhancementNew feature or requestNew feature or request
Milestone
Description
Optimize collision detection using algorithm such as Quaternary Spatial Partitioning.
github-breakout/src/game/breakout.ts
Lines 85 to 98 in 61b9678
| // TODO reduce the computational cost | |
| let remainingContributions = 0 | |
| this.blocks | |
| .filter((b) => b.life > 0) | |
| .forEach((b) => { | |
| const d = intersectDirection(this.ball, b) | |
| // the ball hit the block | |
| if (d !== Direction.None) { | |
| this.ball.onCollide(d) | |
| b.onCollide() | |
| this.score += b.origianlLife | |
| } | |
| remainingContributions += b.life | |
| }) |
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request