diff --git a/r8wkd1wwip.js b/r8wkd1wwip.js new file mode 100644 index 0000000..dc4be2c --- /dev/null +++ b/r8wkd1wwip.js @@ -0,0 +1,89 @@ +if (!this.entityLoaded) { + return; +} + +if (this.entityLoaded.gameOver) { + return; +} + +if (!this.initialized) { + + this.totalTime = 0; + + /** + * Waiting means - this block is on top of some blocks which are busy disappearing + * - so wait for the fall to complete + */ + this.waiting = false; + + this.animation = this.entityLoaded.animation; + + this.translationSpeed = this.animation.translationSpeed; + + this.drop = false; + + this.moveQueue = []; + + this.initialized = true; +} + +var moved = true; +var fall = false; + +if (this.waiting) { + fall = true; +} else { + this.totalTime += data.delta; +} + +if (this.drop) { + + this.animation.translationSpeed = 70; + + fall = true; + + if (this.moveQueue && this.moveQueue.length > 0) { + + var tryMove = function () { + if (this.moveQueue.length > 0) { + + var move = this.moveQueue[0]; + + if (this.moveBlock(null, move, 1, true)) { + this.moveQueue.splice(0, 1); + tryMove(); + } + } + }.bind(this); + + tryMove(); + } +} + +if (this.totalTime > this.entityLoaded.speed) { + this.totalTime = 0; + fall = true; +} + +if (fall) { + moved = this.moveBlock(null, {down: true}, 1, true); +} + +if (moved === null) { + this.waiting = true; +} else { + this.waiting = false; +} + +if (moved === false) { + + this.drop = false; + + this.moveQueue = []; + + this.stopBlock(); + + this.animation.translationSpeed = this.translationSpeed; +} + +//@ sourceURL=beforeRender.js \ No newline at end of file