Initial Commit: CC - Bacon - Before Render (huvjkw0lj3.js)

beta.r3js.org
-=yb4f310 2018-02-18 20:20:46 +01:00
parent dcf4eefb64
commit a37a8db6b2
1 changed files with 89 additions and 0 deletions

89
huvjkw0lj3.js Normal file
View File

@ -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