Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 150 bytes modified

beta.r3js.org
-=yb4f310 2018-03-13 13:41:24 +01:00
parent bf60182b5b
commit 55902c7d32
1 changed files with 13 additions and 3 deletions

View File

@ -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
*/