From b1e4118bbebce207855efdb87d709d77f97bc376 Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Mon, 12 Mar 2018 14:40:09 +0100 Subject: [PATCH] Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 541 bytes modified --- 21g30t1e75.js | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/21g30t1e75.js b/21g30t1e75.js index 3f87ce7..2b34ba7 100644 --- a/21g30t1e75.js +++ b/21g30t1e75.js @@ -33,10 +33,35 @@ this.scene = GameLib.EntityManager.Instance.findComponentById('pllp034hsj'); */ this.snake = []; +GameLib.CustomCode.BODY_TYPE_HEAD = 0x1; +GameLib.CustomCode.BODY_TYPE_TAIL = 0x2; + GameLib.CustomCode.prototype.advanceSnake = function(delta) { }.bind(this); +GameLib.CustomCode.prototype.cloneBody = function(bodyType) { + + var body = null; + + switch (bodyType) { + case (GameLib.CustomCode.BODY_TYPE_HEAD) : + body = this.meshEnd.clone(); + break; + case (GameLib.CustomCode.BODY_TYPE_TAIL) : + body = this.meshEnd.clone(); + body.rotation.z = Math.PI; + body.updateInstance('rotation'); + break; + default: + console.warn('unhandled body type : ' + bodyType); + break; + } + + return body; + +}.bind(this); + GameLib.CustomCode.prototype.createMaterial = function(image) { var diffuseMap = new GameLib.D3.Texture.Image( this.runtime.graphics, @@ -70,7 +95,7 @@ GameLib.CustomCode.prototype.createGameMesh = function(image) { /** * Create our objects */ -this.meshHead = this.createGameMesh(this.imageEnd); +this.meshEnd = this.createGameMesh(this.imageEnd); this.meshPatty = this.createGameMesh(this.imagePatty); this.meshBodyPatty = this.createGameMesh(this.imageBodyPatty);