diff options
author | Logan Hunt <loganhunt@simponic.xyz> | 2022-04-05 19:45:09 -0600 |
---|---|---|
committer | Logan Hunt <loganhunt@simponic.xyz> | 2022-04-05 19:45:09 -0600 |
commit | 558e91a4420bb52e9b8dad624cff3859ec64ea43 (patch) | |
tree | e0fdac613ebd8f01f03fe0c0d202833c908f5acd /src/systems/physics.js | |
parent | 69596ba244d6959dfe188ce958542c062b475f75 (diff) | |
download | bbiy-558e91a4420bb52e9b8dad624cff3859ec64ea43.tar.gz bbiy-558e91a4420bb52e9b8dad624cff3859ec64ea43.zip |
Added collision system, added changedId's which doesn't do anything rn
Diffstat (limited to 'src/systems/physics.js')
-rw-r--r-- | src/systems/physics.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/systems/physics.js b/src/systems/physics.js index a49edca..d72b1a0 100644 --- a/src/systems/physics.js +++ b/src/systems/physics.js @@ -1,7 +1,7 @@ game.system.Physics = () => { - const update = (elapsedTime) => { - for (let id in game.entities) { - const entity = game.entities[id]; + const update = (elapsedTime, entities, changedIds) => { + for (let id in entities) { + const entity = entities[id]; if (entity.hasComponent("momentum") && entity.hasComponent("appearance")) { const {dx, dy} = entity.components.momentum; entity.components.position.x += dx * elapsedTime; @@ -9,6 +9,8 @@ game.system.Physics = () => { entity.components.position = clamp(entity.components.position, game.canvas.width - entity.components.appearance.width, game.canvas.height - entity.components.appearance.height); } } + + return new Set(); } return { update }; }
\ No newline at end of file |