summaryrefslogtreecommitdiff
path: root/src/systems/collision.js
diff options
context:
space:
mode:
authorLogan Hunt <loganhunt@simponic.xyz>2022-04-07 13:54:12 -0600
committerLogan Hunt <loganhunt@simponic.xyz>2022-04-07 13:54:12 -0600
commit57509cad921a3e17c9c92d7221c9325e50ede52f (patch)
treebeb64a25e75c6e69d862f10d271950b89b1e0da6 /src/systems/collision.js
parenta54812ed50379bd8baacce53c16aeccdff752327 (diff)
downloadbbiy-57509cad921a3e17c9c92d7221c9325e50ede52f.tar.gz
bbiy-57509cad921a3e17c9c92d7221c9325e50ede52f.zip
Add particles to pushing entities
Diffstat (limited to 'src/systems/collision.js')
-rw-r--r--src/systems/collision.js19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/systems/collision.js b/src/systems/collision.js
index 7739bae..152dcd6 100644
--- a/src/systems/collision.js
+++ b/src/systems/collision.js
@@ -20,7 +20,6 @@ game.system.Collision = (entitiesGrid) => {
for (let next of entitiesInCell.values()) {
if (next.hasComponent("stop")) {
- console.log("WALL FOUND")
wall = next;
found = false;
break;
@@ -36,10 +35,24 @@ game.system.Collision = (entitiesGrid) => {
} while(found);
if (wall) {
- console.log("WALL")
entity.removeComponent("momentum");
} else {
- entitiesToPush.map((e) => e.addComponent(game.components.Momentum({...momentum})));
+ 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;
+ e.addComponent(game.components.Momentum({...momentum}))
+ });
}
}
}