Make sure we don't double-buffer an input causing undo to become stuck
This commit is contained in:
parent
69b5f4448c
commit
1bdfb42c3d
@ -11,14 +11,16 @@ game.system.KeyboardInput = (undoSystem) => {
|
|||||||
const entity = entities[id];
|
const entity = entities[id];
|
||||||
if (entity.hasComponent('controllable')) {
|
if (entity.hasComponent('controllable')) {
|
||||||
const controls = entity.components.controllable.controls;
|
const controls = entity.components.controllable.controls;
|
||||||
if (controls.includes('left') && keys['ArrowLeft']) {
|
if (!changedIds.has(entity.id)) {
|
||||||
entity.addComponent(game.components.Momentum({ dx: -1, dy: 0 }));
|
if (controls.includes('left') && keys['ArrowLeft']) {
|
||||||
} else if (controls.includes('right') && keys['ArrowRight']) {
|
entity.addComponent(game.components.Momentum({ dx: -1, dy: 0 }));
|
||||||
entity.addComponent(game.components.Momentum({ dx: 1, dy: 0 }));
|
} else if (controls.includes('right') && keys['ArrowRight']) {
|
||||||
} else if (controls.includes('up') && keys['ArrowUp']) {
|
entity.addComponent(game.components.Momentum({ dx: 1, dy: 0 }));
|
||||||
entity.addComponent(game.components.Momentum({ dx: 0, dy: -1 }));
|
} else if (controls.includes('up') && keys['ArrowUp']) {
|
||||||
} else if (controls.includes('down') && keys['ArrowDown']) {
|
entity.addComponent(game.components.Momentum({ dx: 0, dy: -1 }));
|
||||||
entity.addComponent(game.components.Momentum({ dx: 0, dy: 1 }));
|
} else if (controls.includes('down') && keys['ArrowDown']) {
|
||||||
|
entity.addComponent(game.components.Momentum({ dx: 0, dy: 1 }));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user