Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 150 bytes modified
parent
bf60182b5b
commit
55902c7d32
|
@ -57,6 +57,7 @@ this.direction = {
|
||||||
x : -1,
|
x : -1,
|
||||||
y : 0
|
y : 0
|
||||||
}
|
}
|
||||||
|
this.rotation = Math.PI / 2;
|
||||||
|
|
||||||
GameLib.CustomCode.prototype.createMaterial = function(image) {
|
GameLib.CustomCode.prototype.createMaterial = function(image) {
|
||||||
var diffuseMap = new GameLib.D3.Texture.Image(
|
var diffuseMap = new GameLib.D3.Texture.Image(
|
||||||
|
@ -143,6 +144,7 @@ GameLib.CustomCode.SnakeBody = function(
|
||||||
this.applyToMesh();
|
this.applyToMesh();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
GameLib.CustomCode.SnakeBody.prototype.clone = function() {
|
GameLib.CustomCode.SnakeBody.prototype.clone = function() {
|
||||||
return new GameLib.CustomCode.SnakeBody(
|
return new GameLib.CustomCode.SnakeBody(
|
||||||
this.bodyType,
|
this.bodyType,
|
||||||
|
@ -153,7 +155,7 @@ GameLib.CustomCode.SnakeBody.prototype.clone = function() {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
GameLib.CustomCode.SnakeBody.prototype.applyToMesh = function() {
|
GameLib.CustomCode.SnakeBody.prototype.applyToMesh = function() {
|
||||||
|
|
||||||
this.mesh.position.x = this.position.x + GameLib.CustomCode.GRID_OFFSET_X;
|
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');
|
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.x += direction.x;
|
||||||
this.position.y += direction.y;
|
this.position.y += direction.y;
|
||||||
|
|
||||||
|
this.rotation = rotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameLib.CustomCode.prototype.advanceSnake = function(delta) {
|
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 = [
|
this.snake = [
|
||||||
new GameLib.CustomCode.SnakeBody(
|
new GameLib.CustomCode.SnakeBody(
|
||||||
GameLib.CustomCode.BODY_TYPE_HEAD,
|
GameLib.CustomCode.BODY_TYPE_HEAD,
|
||||||
|
@ -283,7 +293,7 @@ GameLib.Event.Subscribe(
|
||||||
* Other Settings
|
* Other Settings
|
||||||
*/
|
*/
|
||||||
this.speed = GameLib.CustomCode.SPEED_INITIAL;
|
this.speed = GameLib.CustomCode.SPEED_INITIAL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Re-initialize our other custom code components
|
* Re-initialize our other custom code components
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue