From 069b5abdbc8022f2fb5fb22a77884b666764f8d6 Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Thu, 22 Mar 2018 12:51:07 +0100 Subject: [PATCH] Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 557 bytes modified --- 21g30t1e75.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/21g30t1e75.js b/21g30t1e75.js index cde9222..c58f879 100644 --- a/21g30t1e75.js +++ b/21g30t1e75.js @@ -850,6 +850,24 @@ GameLib.CustomCode.prototype.extend = function(gameObject, position, orientation throw new Error('unhandled food type: ' + gameObject.type); } + if (orientation === GameLib.CustomCode.ORIENTATION_UP) { + body.mesh.position.y -= 0.5 * GameLib.CustomCode.BODY_SCALE_Y; + } + + if (orientation === GameLib.CustomCode.ORIENTATION_DOWN) { + body.mesh.position.y += 0.5 * GameLib.CustomCode.BODY_SCALE_Y; + } + + if (orientation === GameLib.CustomCode.ORIENTATION_LEFT) { + body.mesh.position.x += 0.5 * GameLib.CustomCode.BODY_SCALE_X; + } + + if (orientation === GameLib.CustomCode.ORIENTATION_RIGHT) { + body.mesh.position.x -= 0.5 * GameLib.CustomCode.BODY_SCALE_X; + } + + body.mesh.updateInstance('position'); + this.state.eating = true; this.snake.splice(1, 0, body);