Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 1328 bytes modified
parent
026f95faec
commit
ec01a70651
|
@ -148,28 +148,7 @@ GameLib.CustomCode.prototype.visualizeGrid = function (color) {
|
|||
|
||||
}.bind(this)
|
||||
|
||||
GameLib.CustomCode.prototype.createMaterial = function(image) {
|
||||
var diffuseMap = new GameLib.D3.Texture.Image(
|
||||
this.runtime.graphics,
|
||||
{
|
||||
image : image,
|
||||
repeat : {
|
||||
x : 0.99,
|
||||
y : 0.99
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
return new GameLib.D3.Material.Phong(
|
||||
this.runtime.graphics,
|
||||
{
|
||||
diffuseMap : diffuseMap,
|
||||
transparent : true
|
||||
}
|
||||
);
|
||||
}.bind(this);
|
||||
|
||||
GameLib.CustomCode.prototype.createGameMesh = function(image, visible) {
|
||||
GameLib.CustomCode.prototype.createGameMesh = function(material, visible) {
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(visible)) {
|
||||
visible = true;
|
||||
|
@ -179,7 +158,7 @@ GameLib.CustomCode.prototype.createGameMesh = function(image, visible) {
|
|||
this.runtime.graphics,
|
||||
{
|
||||
geometry : this.geometryBody,
|
||||
materials : [this.createMaterial(image)],
|
||||
materials : [material],
|
||||
visible : visible,
|
||||
useQuaternion : false
|
||||
}
|
||||
|
@ -191,29 +170,6 @@ GameLib.CustomCode.prototype.createGameMesh = function(image, visible) {
|
|||
|
||||
}.bind(this)
|
||||
|
||||
/**
|
||||
* Create our objects
|
||||
*/
|
||||
/*
|
||||
this.meshBreadHead = this.createGameMesh(this.imageBreadHead, false);
|
||||
this.meshBreadHead.useQuaternion = false;
|
||||
|
||||
this.meshBreadTail = this.createGameMesh(this.imageBreadTail, false);
|
||||
this.meshBreadTail.useQuaternion = false;
|
||||
|
||||
this.meshBreadPatty = this.createGameMesh(this.imageBreadPatty, false);
|
||||
this.meshBreadPatty.useQuaternion = false;
|
||||
|
||||
this.meshBreadCorner = this.createGameMesh(this.imageBreadCorner, false);
|
||||
this.meshBreadCorner.useQuaternion = false;
|
||||
|
||||
this.meshBacon = this.createGameMesh(this.imageBacon, false);
|
||||
this.meshCheese = this.createGameMesh(this.imageCheese, false);
|
||||
this.meshOnion = this.createGameMesh(this.imageOnion, false);
|
||||
this.meshOnionRing = this.createGameMesh(this.imageOnionRing, false);
|
||||
this.meshPatty = this.createGameMesh(this.imagePatty, false);
|
||||
this.meshTomato = this.createGameMesh(this.imageTomato, false);
|
||||
*/
|
||||
GameLib.CustomCode.prototype.createFood = function(delta) {
|
||||
|
||||
this.foodTime += delta;
|
||||
|
@ -230,22 +186,22 @@ GameLib.CustomCode.prototype.createFood = function(delta) {
|
|||
|
||||
switch (foodType) {
|
||||
case GameLib.CustomCode.FOOD_BACON :
|
||||
mesh = this.createGameMesh(this.imageBacon);
|
||||
mesh = this.createGameMesh(this.materialBacon);
|
||||
break;
|
||||
case GameLib.CustomCode.FOOD_CHEESE :
|
||||
mesh = this.createGameMesh(this.imageCheese);
|
||||
mesh = this.createGameMesh(this.materialCheese);
|
||||
break;
|
||||
case GameLib.CustomCode.FOOD_ONION :
|
||||
mesh = this.createGameMesh(this.imageOnion);
|
||||
mesh = this.createGameMesh(this.materialOnion);
|
||||
break;
|
||||
case GameLib.CustomCode.FOOD_ONION_RING :
|
||||
mesh = this.createGameMesh(this.imageOnionRing);
|
||||
mesh = this.createGameMesh(this.materialOnionRing);
|
||||
break;
|
||||
case GameLib.CustomCode.FOOD_PATTY :
|
||||
mesh = this.createGameMesh(this.imagePatty);
|
||||
mesh = this.createGameMesh(this.materialPatty);
|
||||
break;
|
||||
case GameLib.CustomCode.FOOD_TOMATO :
|
||||
mesh = this.createGameMesh(this.imageTomato);
|
||||
mesh = this.createGameMesh(this.materialTomato);
|
||||
break;
|
||||
default :
|
||||
console.warn('unhandled food type');
|
||||
|
@ -517,7 +473,7 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
|
|||
|
||||
//body.backupMesh.updateInstance('visible');
|
||||
|
||||
body.mesh = this.createGameMesh(this.imageBreadCorner);
|
||||
body.mesh = this.createGameMesh(this.materialBreadCorner);
|
||||
|
||||
body.mesh.position.z = 5;
|
||||
|
||||
|
@ -583,7 +539,7 @@ GameLib.Event.Subscribe(
|
|||
|
||||
this.snake = [
|
||||
new GameLib.CustomCode.SnakeBody(
|
||||
this.createGameMesh(this.imageBreadHead),
|
||||
this.createGameMesh(this.materialBreadHead),
|
||||
{
|
||||
x : 4,
|
||||
y : 4
|
||||
|
@ -591,7 +547,7 @@ GameLib.Event.Subscribe(
|
|||
0
|
||||
),
|
||||
new GameLib.CustomCode.SnakeBody(
|
||||
this.createGameMesh(this.imageBreadPatty),
|
||||
this.createGameMesh(this.materialBreadPatty),
|
||||
{
|
||||
x : 4,
|
||||
y : 3
|
||||
|
@ -599,7 +555,7 @@ GameLib.Event.Subscribe(
|
|||
0
|
||||
),
|
||||
new GameLib.CustomCode.SnakeBody(
|
||||
this.createGameMesh(this.imageBreadPatty),
|
||||
this.createGameMesh(this.materialBreadPatty),
|
||||
{
|
||||
x : 4,
|
||||
y : 2
|
||||
|
@ -607,7 +563,7 @@ GameLib.Event.Subscribe(
|
|||
0
|
||||
),
|
||||
new GameLib.CustomCode.SnakeBody(
|
||||
this.createGameMesh(this.imageBreadTail),
|
||||
this.createGameMesh(this.materialBreadTail),
|
||||
{
|
||||
x : 4,
|
||||
y : 1
|
||||
|
|
Loading…
Reference in New Issue