Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 204 bytes modified
parent
42e335fc2c
commit
b8ebf39eb8
|
@ -71,23 +71,36 @@ GameLib.CustomCode.prototype.initializeGrid = function() {
|
|||
|
||||
GameLib.CustomCode.prototype.cloneBody = function(bodyType) {
|
||||
|
||||
var body = null;
|
||||
var mesh = null;
|
||||
|
||||
switch (bodyType) {
|
||||
case (GameLib.CustomCode.BODY_TYPE_HEAD) :
|
||||
body = this.meshEnd.clone();
|
||||
mesh = this.meshEnd.clone();
|
||||
break;
|
||||
case (GameLib.CustomCode.BODY_TYPE_TAIL) :
|
||||
body = this.meshEnd.clone();
|
||||
body.rotation.z = Math.PI;
|
||||
body.updateInstance('rotation');
|
||||
mesh = this.meshEnd.clone();
|
||||
mesh.rotation.z = Math.PI;
|
||||
mesh.updateInstance('rotation');
|
||||
break;
|
||||
default:
|
||||
console.warn('unhandled body type : ' + bodyType);
|
||||
break;
|
||||
}
|
||||
|
||||
return body;
|
||||
var direction = {
|
||||
x : -1,
|
||||
y : 0
|
||||
};
|
||||
|
||||
if (this.snake.length > 0) {
|
||||
direction.x = this.snake[0].direction.x;
|
||||
direction.y = this.snake[0].direction.y;
|
||||
}
|
||||
|
||||
return {
|
||||
mesh : body,
|
||||
direction : direction
|
||||
}
|
||||
|
||||
}.bind(this);
|
||||
|
||||
|
|
Loading…
Reference in New Issue