From ef40661661eac1261388409a3e1de7cfed45fff5 Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Sun, 18 Feb 2018 17:54:19 +0100 Subject: [PATCH] Update: CC - Bacon - Entity Loaded (2xswm1bwq8.js) 248 bytes modified --- 2xswm1bwq8.js | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/2xswm1bwq8.js b/2xswm1bwq8.js index 4594851..fe6d22c 100644 --- a/2xswm1bwq8.js +++ b/2xswm1bwq8.js @@ -43,7 +43,7 @@ this.scoreTexture = GameLib.EntityManager.Instance.findComponentById('kva68t4dm8 * Animations */ this.animation = GameLib.EntityManager.Instance.findComponentById('tnlwgvf12x'); -this.animationSystem = GameLib.EntityManager.Instance.queryComponents(GameLib.Component.SYSTEM_ANIMATION)[0]; +//this.animationSystem = GameLib.EntityManager.Instance.queryComponents(GameLib.Component.SYSTEM_ANIMATION)[0]; /** * Lights @@ -822,9 +822,10 @@ GameLib.CustomCode.prototype.rotateBlock = function (clockwise) { var targetRotation = this.block.center.rotation.z + Math.PI / 2; } - this.animationSystem.stop(); - - var originalRotation = this.block.center.rotation.z; + var rotationBackup = { + instance : this.block.center.instance.rotation.z, + object : this.block.center.rotation.z + } this.block.center.rotation.z = targetRotation; this.block.center.updateInstance('rotation'); @@ -833,20 +834,27 @@ GameLib.CustomCode.prototype.rotateBlock = function (clockwise) { if (boundaries.collision) { - this.block.center.rotation.z = originalRotation; - this.block.center.updateInstance('rotation'); + /** + * There's a collision, restore the instance rotation + */ + this.block.center.instance.rotation.z = rotationBackup.instance; - this.animationSystem.start(); + /** + * And also the object rotation + */ + this.block.center.rotation.z = rotationBackup.object; } else { - this.block.center.rotation.z = originalRotation; - - this.animationSystem.start(); + /** + * Restore our instance rotation + */ + this.block.center.instance.rotation.z = rotationBackup.instance; + /** + * Update our object to the new rotation + */ this.block.center.rotation.z = targetRotation; - this.block.center.updateInstance('rotation'); - } }.bind(this); @@ -1307,7 +1315,7 @@ GameLib.CustomCode.prototype.spawnBigBlock = function () { GameLib.CustomCode.prototype.getNextBlock = function () { - this.animationSystem.stop(); +// this.animationSystem.stop(); this.block = this.spawnBigBlock(); @@ -1318,7 +1326,7 @@ GameLib.CustomCode.prototype.getNextBlock = function () { } ); - this.animationSystem.start(); +// this.animationSystem.start(); this.animation.meshes.push(this.block.center);