Fix collision bug and setup tests for GameLabP5#9714
Conversation
|
|
||
| if (sprite.collider instanceof this.CircleCollider) { | ||
| return window.p5.dist(mousePosition.x, mousePosition.y, sprite.collider.center.x, sprite.collider.center.y) < sprite.collider.radius; | ||
| return this.dist(mousePosition.x, mousePosition.y, sprite.collider.center.x, sprite.collider.center.y) < sprite.collider.radius; |
There was a problem hiding this comment.
This is the actual fix of the collision bug.
| {pattern: 'build/**/*', watched: false, included: false, nocache: true}, | ||
| {pattern: 'static/**/*', watched: false, included: false, nocache: true}, | ||
| {pattern: 'lib/p5play/p5.js'}, | ||
| {pattern: 'lib/p5play/p5.play.js'}, |
There was a problem hiding this comment.
@pcardune I'm pretty sure we did this correctly, can you confirm? p5.js and p5.play.js absolutely insist on being included as script tags so they can load stuff onto window (they are not requirejs-compatible) so we put them here to include them in tests ahead of any of the actual test files.
It's not great that this means they'll be included for any/every test run of any kind, but I didn't see a better way to do this and use them in our gamelab unit tests. I also doubt they'll slow the build down very much, as they're both prebuilt libraries, leaf nodes in the dependency tree.
Thoughts?
There was a problem hiding this comment.
You could import them where you need them using the webpack script-loader. See https://github.com/webpack/script-loader.
There was a problem hiding this comment.
updated - thanks for the suggestion @pcardune
ad0fd4d to
949bbc6
Compare
|
LGTM |
No description provided.