summaryrefslogtreecommitdiff
path: root/src/systems/collision.js
diff options
context:
space:
mode:
authorLogan Hunt <loganhunt@simponic.xyz>2022-04-10 22:13:05 -0600
committerLogan Hunt <loganhunt@simponic.xyz>2022-04-10 22:13:05 -0600
commit69b5f4448c1cbd00ebcb6f444f2434cc272b7e97 (patch)
tree02152d8eb67f1b4913222b412d72740f59808c7b /src/systems/collision.js
parenta23ea2e014d140dbe9c090e6cf7d55906480c260 (diff)
downloadbbiy-69b5f4448c1cbd00ebcb6f444f2434cc272b7e97.tar.gz
bbiy-69b5f4448c1cbd00ebcb6f444f2434cc272b7e97.zip
Unlimited undo; add spritename component instead of sprites on each entity; update canvas on game object
Diffstat (limited to 'src/systems/collision.js')
-rw-r--r--src/systems/collision.js29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/systems/collision.js b/src/systems/collision.js
index 152dcd6..08a1d91 100644
--- a/src/systems/collision.js
+++ b/src/systems/collision.js
@@ -1,5 +1,6 @@
game.system.Collision = (entitiesGrid) => {
const update = (elapsedTime, entities, changedIds) => {
+ const thisChangedIds = new Set();
for (let entity of Object.keys(entities).map((id) => entities[id])) {
if (entity.hasComponent("controllable") && entity.hasComponent("gridPosition") && entity.hasComponent("momentum")) {
const momentum = unitize(entity.components.momentum);
@@ -38,25 +39,25 @@ game.system.Collision = (entitiesGrid) => {
entity.removeComponent("momentum");
} else {
entitiesToPush.map((e) => {
- const particles = game.createBorderParticles({
- colors: ["#16f7c9", "#0d6e5a", "#2fa18a", "#48cfb4", "#58877d", "#178054", "#2cdb92"],
- maxSpeed: 0.20,
- minRadius: 1,
- maxRadius: 3,
- minLife: 100,
- maxLife: 300,
- minAmount: 20,
- maxAmount: 50,
- });
- particles.addComponent(game.components.Position(e.components.position));
- particles.addComponent(game.components.Appearance({width: game.canvas.width / game.config.xDim, height: game.canvas.height / game.config.yDim}));
- game.entities[particles.id] = particles;
+// const particles = game.createBorderParticles({
+// colors: ["#16f7c9", "#0d6e5a", "#2fa18a", "#48cfb4", "#58877d", "#178054", "#2cdb92"],
+// maxSpeed: 0.20,
+// minRadius: 1,
+// maxRadius: 3,
+// minLife: 100,
+// maxLife: 300,
+// minAmount: 20,
+// maxAmount: 50,
+// });
+// particles.addComponent(game.components.Position(e.components.position));
+// particles.addComponent(game.components.Appearance({width: game.canvas.width / game.config.xDim, height: game.canvas.height / game.config.yDim}));
+// game.entities[particles.id] = particles;
e.addComponent(game.components.Momentum({...momentum}))
});
}
}
}
- return new Set();
+ return thisChangedIds;
};
return { update };
};