- commit
- 52fcc6753f7285ee8556e82c7ff943277a319ea7
- parent
- 1f43f2a0c3bea3b51d65e68bb6929b537e697681
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2018-09-16 12:02
prevent exponential acceleration
Diffstat
| M | towers.js | 6 | ++++-- |
1 files changed, 4 insertions, 2 deletions
diff --git a/towers.js b/towers.js
@@ -117,8 +117,10 @@ document.addEventListener('keydown', function(event) {
117 117 Matter.Body.rotate(falling, -Math.PI / 2);
118 118 } else if (event.key == 'ArrowDown') {
119 119 event.preventDefault();
120 -1 control = false;
121 -1 Matter.Body.setVelocity(falling, {x: 0, y: falling.velocity.y * 2});
-1 120 if (control) {
-1 121 control = false;
-1 122 Matter.Body.setVelocity(falling, {x: 0, y: falling.velocity.y * 2});
-1 123 }
122 124 } else if (event.key == 'Escape') {
123 125 event.preventDefault();
124 126 Matter.Composite.clear(engine.world, true);