diff options
author | Logan Hunt <loganhunt@simponic.xyz> | 2022-04-02 18:37:36 -0600 |
---|---|---|
committer | Logan Hunt <loganhunt@simponic.xyz> | 2022-04-02 18:37:36 -0600 |
commit | aef3c05bc7f3feba7832078aa1cb4bd96c52c1dd (patch) | |
tree | 72a5db540a03fe8207e26ee55b64163fe84a8215 /src/game.js | |
parent | 61c835723a685121316b196fb6f49ab10c92c240 (diff) | |
download | bbiy-aef3c05bc7f3feba7832078aa1cb4bd96c52c1dd.tar.gz bbiy-aef3c05bc7f3feba7832078aa1cb4bd96c52c1dd.zip |
Simple controlling system
Diffstat (limited to 'src/game.js')
-rw-r--r-- | src/game.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/game.js b/src/game.js index 9cf60c6..04aa4fc 100644 --- a/src/game.js +++ b/src/game.js @@ -11,7 +11,7 @@ game.loop = (timeStamp) => { } game.initialize = () => { - game.systemOrder = ["render", "physics", "gridSystem"]; + game.systemOrder = ["render", "physics", "gridSystem", "keyboardInput"]; game.systems = { render: game.system.Render(game.graphics), physics: game.system.Physics(), @@ -21,6 +21,7 @@ game.initialize = () => { canvasWidth: game.canvas.width, canvasHeight: game.canvas.height, }), + keyboardInput: game.system.KeyboardInput(), }; game.entities = {}; @@ -34,6 +35,7 @@ game.initialize = () => { game.rock = game.createRock(); game.rock.addComponent(game.components.Position({x: 200, y: 200})); game.rock.addComponent(game.components.GridPosition({x: 0, y: 0})); + game.rock.addComponent(game.components.Controllable({controls: ['left', 'right', 'up', 'down']})); game.entities[game.rock.id] = game.rock; lastTimeStamp = performance.now() |