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

beta.r3js.org
-=yb4f310 2018-03-20 14:34:55 +01:00
parent 500a20721e
commit 9cd7546e15
1 changed files with 35 additions and 10 deletions

View File

@ -75,6 +75,34 @@ this.state = {
flip : 0
};
GameLib.CustomCode.prototype.visualizeGrid = function (color) {
if (this.starsMesh) {
this.scene.instance.remove(this.starsMesh);
}
this.starsGeometry = new THREE.Geometry();
for (var y = 0; y < this.grid.length; y++) {
for (var x = 0; x < this.grid[y].length; x++) {
this.starsGeometry.vertices.push(
new THREE.Vector3(
x,
y,
5
)
);
}
}
var starsMaterial = new THREE.PointsMaterial({color: color, size: 0.1});
this.starsMesh = new THREE.Points(this.starsGeometry, starsMaterial);
this.scene.instance.add(this.starsMesh);
}.bind(this)
GameLib.CustomCode.prototype.createMaterial = function(image) {
var diffuseMap = new GameLib.D3.Texture.Image(
this.runtime.graphics,
@ -404,7 +432,7 @@ GameLib.CustomCode.prototype.advanceSnake = function(delta) {
}.bind(this);
/*
GameLib.CustomCode.prototype.initializeGrid = function() {
this.grid = [];
@ -413,17 +441,13 @@ GameLib.CustomCode.prototype.initializeGrid = function() {
this.grid[x] = [];
for (var y = 0; y < GameLib.CustomCode.GRID_HEIGHT; y++) {
this.grid[x][y] = {
mesh : null,
direction : {
x : 0,
y : 0
}
mesh : null
}
}
}
}.bind(this);
*/
GameLib.Event.Subscribe(
GameLib.Event.GAME_START,
@ -512,9 +536,10 @@ function(y) {
);
}
);
this.initializeGrid();
*/
*/
this.initializeGrid();
this.visualizeGrid();
/**
* Other Settings