trickytowers

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

commit
1f43f2a0c3bea3b51d65e68bb6929b537e697681
parent
320e55fa9b91bc4e4411236a803b729090500bc5
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2018-09-16 11:50
better speed calculation

Diffstat

M towers.js 3 ++-

1 files changed, 2 insertions, 1 deletions


diff --git a/towers.js b/towers.js

@@ -3,6 +3,7 @@ var Matter = require('matter-js');
    3     3 var TILE_SIZE = 20;
    4     4 var WIDTH = 10 * TILE_SIZE;
    5     5 var HEIGHT = 30 * TILE_SIZE;
   -1     6 var SPEED = 4
    6     7 
    7     8 var BLOCKS = [{
    8     9     label: 'I',
@@ -76,7 +77,7 @@ var previousTimestamp;
   76    77 Matter.Events.on(engine, 'beforeUpdate', function(event) {
   77    78     if (previousTimestamp && control) {
   78    79         var dt = event.timestamp - previousTimestamp;
   79    -1         var dy = dt * 0.1;
   -1    80         var dy = dt / 1000 * TILE_SIZE * SPEED;
   80    81         Matter.Body.setVelocity(falling, {x: 0, y: dy});
   81    82         Matter.Body.setPosition(falling, {
   82    83             x: falling.position.x,