trickytowers

simple tricky towers clone using matter.js
git clone https://git.ce9e.org/trickytowers.git

commit
69a2823768f4fc48172ece5b45a35757e7cd1866
parent
52fcc6753f7285ee8556e82c7ff943277a319ea7
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2018-09-16 11:50
build

Diffstat

M docs/build.js 9 ++++++---

1 files changed, 6 insertions, 3 deletions


diff --git a/docs/build.js b/docs/build.js

@@ -10369,6 +10369,7 @@ var Matter = require('matter-js');
10369 10369 var TILE_SIZE = 20;
10370 10370 var WIDTH = 10 * TILE_SIZE;
10371 10371 var HEIGHT = 30 * TILE_SIZE;
   -1 10372 var SPEED = 4
10372 10373 
10373 10374 var BLOCKS = [{
10374 10375     label: 'I',
@@ -10442,7 +10443,7 @@ var previousTimestamp;
10442 10443 Matter.Events.on(engine, 'beforeUpdate', function(event) {
10443 10444     if (previousTimestamp && control) {
10444 10445         var dt = event.timestamp - previousTimestamp;
10445    -1         var dy = dt * 0.1;
   -1 10446         var dy = dt / 1000 * TILE_SIZE * SPEED;
10446 10447         Matter.Body.setVelocity(falling, {x: 0, y: dy});
10447 10448         Matter.Body.setPosition(falling, {
10448 10449             x: falling.position.x,
@@ -10482,8 +10483,10 @@ document.addEventListener('keydown', function(event) {
10482 10483         Matter.Body.rotate(falling, -Math.PI / 2);
10483 10484     } else if (event.key == 'ArrowDown') {
10484 10485         event.preventDefault();
10485    -1         control = false;
10486    -1         Matter.Body.setVelocity(falling, {x: 0, y: falling.velocity.y * 2});
   -1 10486         if (control) {
   -1 10487             control = false;
   -1 10488             Matter.Body.setVelocity(falling, {x: 0, y: falling.velocity.y * 2});
   -1 10489         }
10487 10490     } else if (event.key == 'Escape') {
10488 10491         event.preventDefault();
10489 10492         Matter.Composite.clear(engine.world, true);