Add particles to pushing entities
This commit is contained in:
parent
a54812ed50
commit
57509cad92
@ -20,7 +20,6 @@ game.system.Collision = (entitiesGrid) => {
|
|||||||
|
|
||||||
for (let next of entitiesInCell.values()) {
|
for (let next of entitiesInCell.values()) {
|
||||||
if (next.hasComponent("stop")) {
|
if (next.hasComponent("stop")) {
|
||||||
console.log("WALL FOUND")
|
|
||||||
wall = next;
|
wall = next;
|
||||||
found = false;
|
found = false;
|
||||||
break;
|
break;
|
||||||
@ -36,10 +35,24 @@ game.system.Collision = (entitiesGrid) => {
|
|||||||
} while(found);
|
} while(found);
|
||||||
|
|
||||||
if (wall) {
|
if (wall) {
|
||||||
console.log("WALL")
|
|
||||||
entity.removeComponent("momentum");
|
entity.removeComponent("momentum");
|
||||||
} else {
|
} 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}))
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,45 +67,3 @@ game.system.Grid = (entitiesGrid) => {
|
|||||||
|
|
||||||
return { gameCoordsToGrid, gridCoordsToGame, update, gridWidth, gridHeight };
|
return { gameCoordsToGrid, gridCoordsToGame, update, gridWidth, gridHeight };
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// const proposed = {...newGridCoords};
|
|
||||||
// let wall = false;
|
|
||||||
// let entitiesToPush = [];
|
|
||||||
// if (entity.hasComponent("controllable")) {
|
|
||||||
// let found = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
// if (entity.hasComponent("controllable")) {
|
|
||||||
// if (!wall) {
|
|
||||||
// entity.components.gridPosition = {...entity.components.gridPosition, ...newGridCoords};
|
|
||||||
// entitiesToPush.map((e) => e.addComponent(game.components.Momentum({...momentumVector})));
|
|
||||||
// }
|
|
||||||
// const particles = game.createBorderParticles({
|
|
||||||
// colors: ["#FF0000", "#00FF00", "#0000FF", "#FFFF00", "#FF00FF", "#00FFFF"],
|
|
||||||
// maxAmount: 100,
|
|
||||||
// minAmount: 25,
|
|
||||||
// minLife: 100,
|
|
||||||
// maxLife: 300,
|
|
||||||
// minRadius: 1,
|
|
||||||
// maxRadius: 3,
|
|
||||||
// maxSpeed: 0.15,
|
|
||||||
// });
|
|
||||||
// particles.addComponent(game.components.Position(gridCoordsToGame(oldGridCoords)));
|
|
||||||
// particles.addComponent(game.components.Appearance({width: 50, height: 50}));
|
|
||||||
// game.entities[particles.id] = particles;
|
|
||||||
// } else {
|
|
||||||
// entity.components.gridPosition = {...entity.components.gridPosition, ...newGridCoords};
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// entity.addComponent(game.components.Position({...gridCoordsToGame(entity.components.gridPosition)}));
|
|
||||||
// };
|
|
||||||
// });
|
|
Loading…
Reference in New Issue
Block a user