From 69b5f4448c1cbd00ebcb6f444f2434cc272b7e97 Mon Sep 17 00:00:00 2001 From: Logan Hunt Date: Sun, 10 Apr 2022 22:13:05 -0600 Subject: Unlimited undo; add spritename component instead of sprites on each entity; update canvas on game object --- src/systems/keyboardInput.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/systems/keyboardInput.js') diff --git a/src/systems/keyboardInput.js b/src/systems/keyboardInput.js index 60a62a1..5ce6737 100644 --- a/src/systems/keyboardInput.js +++ b/src/systems/keyboardInput.js @@ -1,4 +1,4 @@ -game.system.KeyboardInput = () => { +game.system.KeyboardInput = (undoSystem) => { "use strict"; const keys = {}; const keyPress = (event) => { @@ -20,9 +20,11 @@ game.system.KeyboardInput = () => { } else if (controls.includes('down') && keys['ArrowDown']) { entity.addComponent(game.components.Momentum({ dx: 0, dy: 1 })); } - } } + if (keys['z']) { + undoSystem.undo(entities); + } Object.keys(keys).map((key) => delete keys[key]); return new Set(); -- cgit v1.2.3-70-g09d2