canvas-based-core 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,15 +8,15 @@ export class CollisionDetection2D extends CollisionDetection {
8
8
  }
9
9
 
10
10
  static leftCollisionDetected(source, target){
11
- return ((source.x) <= (target.x + target.width)) &&
12
- ((source.x + source.width) >= (target.x + target.width)) &&
13
- this.isWithinYRange(source, target);
11
+ return (source.x >= target.x) &&
12
+ (source.x <= (target.x + target.width)) &&
13
+ this.#isWithinYRange(source, target);
14
14
  }
15
15
 
16
16
  static rightCollisionDetected(source, target){
17
- return ((source.x + source.width) >= target.x) &&
18
- ((source.x) <= (target.x)) &&
19
- this.isWithinYRange(source, target);
17
+ return ((source.x + source.width) >= target.x) &&
18
+ ((source.x + source.width) <= (target.x + target.width)) &&
19
+ this.#isWithinYRange(source, target);
20
20
  }
21
21
 
22
22
  static horizontalCollisionDetected(source, target){
@@ -51,15 +51,15 @@ export class CollisionDetection2D extends CollisionDetection {
51
51
  }
52
52
 
53
53
  static topCollisionDetected(source, target){
54
- return ((source.y) <= (target.y + target.height)) &&
55
- ((source.y + source.height) >= (target.y + target.height)) &&
56
- this.isWithinXRange(source, target);
54
+ return (source.y >= target.y) &&
55
+ (source.y <= (target.y + target.height)) &&
56
+ this.#isWithinXRange(source, target);
57
57
  }
58
58
 
59
59
  static bottomCollisionDetected(source, target){
60
- return ((source.y + source.height) >= target.y) &&
61
- ((source.y) <= (target.y)) &&
62
- this.isWithinXRange(source, target);
60
+ return ((source.y + source.height) >= target.y) &&
61
+ ((source.y + source.height) <= (target.y + target.height)) &&
62
+ this.#isWithinXRange(source, target);
63
63
  }
64
64
 
65
65
  static verticalCollisionDetected(source, target){
@@ -106,12 +106,12 @@ export class CollisionDetection2D extends CollisionDetection {
106
106
  }
107
107
  }
108
108
 
109
- static isWithinXRange(source, target){
109
+ static #isWithinXRange(source, target){
110
110
  return (((source.x + source.width) >= target.x) && (source.x <= target.x)) ||
111
111
  ((source.x <= (target.x + target.width)) && (source.x >= target.x));
112
112
  }
113
113
 
114
- static isWithinYRange(source, target){
114
+ static #isWithinYRange(source, target){
115
115
  return (((source.y + source.height) >= target.y) && (source.y <= target.y)) ||
116
116
  ((source.y <= (target.y + target.height)) && (source.y >= target.y));
117
117
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvas-based-core",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "canvas-based-core",
5
5
  "homepage": "https://github.com/pr1v4te4cc0unt/canvas-based-core#readme",
6
6
  "bugs": {