r3-custom-code/o4c478xpx3.js

74 lines
1.2 KiB
JavaScript
Raw Normal View History

if (!this.entityLoaded) {
return;
}
if (!this.initialized) {
this.totalTime = 0;
this.waiting = false;
this.gameOver = false;
this.moveQueue = [];
this.initialized = true;
}
if (this.gameOver) {
return;
}
var moved = true;
var fall = false;
if (this.waiting) {
fall = true;
} else {
this.totalTime += data.delta;
}
if (this.drop) {
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(this.block, 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(this.block, {down: true}, 1, true);
}
if (moved === null) {
this.waiting = true;
} else {
this.waiting = false;
}
if (moved === false) {
this.drop = false;
this.moveQueue = [];
this.bottomReached();
}
//@ sourceURL=beforeRender.js