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 +1 -1
- package/shared/GameLoop.cpp +13 -5
package/package.json
CHANGED
package/shared/GameLoop.cpp
CHANGED
|
@@ -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
|
-
|
|
128
|
-
|
|
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
|
}
|