rngine 0.11.0 → 0.11.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rngine",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "React Native 2D game engine powered by Nitro Modules",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -124,12 +124,20 @@ void GameLoop::runSystems() {
124
124
  if (system.collisions.has_value()) {
125
125
  for (const auto &pair : system.collisions.value()) {
126
126
  for (const auto &c : _collisions) {
127
- bool matchesForward =
128
- entityIdMatches(c.a, pair.a) && entityIdMatches(c.b, pair.b);
129
- bool matchesReverse =
130
- entityIdMatches(c.a, pair.b) && entityIdMatches(c.b, pair.a);
131
- if (matchesForward || matchesReverse) {
127
+
128
+ if (entityIdMatches(c.a, pair.a) && entityIdMatches(c.b, pair.b)) {
132
129
  systemContext.collisions.push_back(c);
130
+ } else if (entityIdMatches(c.a, pair.b) &&
131
+ entityIdMatches(c.b, pair.a)) {
132
+ auto swappedCollision = c;
133
+
134
+ swappedCollision.a = c.b;
135
+ swappedCollision.b = c.a;
136
+
137
+ swappedCollision.nx = -c.nx;
138
+ swappedCollision.ny = -c.ny;
139
+
140
+ systemContext.collisions.push_back(swappedCollision);
133
141
  }
134
142
  }
135
143
  }