From 55902c7d3259fcbc6d002cb029c254f573efd7ac Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Tue, 13 Mar 2018 13:41:24 +0100 Subject: [PATCH] Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 150 bytes modified --- 21g30t1e75.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/21g30t1e75.js b/21g30t1e75.js index e7ed20e..6f5d86c 100644 --- a/21g30t1e75.js +++ b/21g30t1e75.js @@ -57,6 +57,7 @@ this.direction = { x : -1, y : 0 } +this.rotation = Math.PI / 2; GameLib.CustomCode.prototype.createMaterial = function(image) { var diffuseMap = new GameLib.D3.Texture.Image( @@ -143,6 +144,7 @@ GameLib.CustomCode.SnakeBody = function( this.applyToMesh(); }; +/* GameLib.CustomCode.SnakeBody.prototype.clone = function() { return new GameLib.CustomCode.SnakeBody( this.bodyType, @@ -153,7 +155,7 @@ GameLib.CustomCode.SnakeBody.prototype.clone = function() { } ); } - +*/ GameLib.CustomCode.SnakeBody.prototype.applyToMesh = function() { this.mesh.position.x = this.position.x + GameLib.CustomCode.GRID_OFFSET_X; @@ -168,9 +170,11 @@ GameLib.CustomCode.SnakeBody.prototype.applyToMesh = function() { this.mesh.updateInstance('rotation'); } -GameLib.CustomCode.SnakeBody.prototype.advance = function(direction) { +GameLib.CustomCode.SnakeBody.prototype.advance = function(direction, rotation) { this.position.x += direction.x; this.position.y += direction.y; + + this.rotation = rotation; } GameLib.CustomCode.prototype.advanceSnake = function(delta) { @@ -250,6 +254,12 @@ GameLib.Event.Subscribe( } ) + this.direction = { + x : -1, + y : 0 + } + this.rotation = Math.PI / 2; + this.snake = [ new GameLib.CustomCode.SnakeBody( GameLib.CustomCode.BODY_TYPE_HEAD, @@ -283,7 +293,7 @@ GameLib.Event.Subscribe( * Other Settings */ this.speed = GameLib.CustomCode.SPEED_INITIAL; - + /** * Re-initialize our other custom code components */