I am currently working my way through a series of tutorials and have encountered an error that I'm struggling to resolve...
It's possible that this issue is simply due to my reliance on IDEs with red underlines for syntax errors, but I really need to figure this out quickly!
The error message reads: TypeError: Tetris.boundingBoxConfig is undefined file:///C:/Users/Timmy/Documents/Emergent%20Tech/Tetris/js/tetris.js Line 127
Here is where I define Tetris.boundingBoxConfig:
var boundingBoxConfig = {
width: 360,
height: 360,
depth: 1200,
splitX: 6,
splitY: 6,
splitZ: 20
};
Tetris.boundingBoxConfig = boundingBoxConfig;
This is the code snippet from line 127:
mesh.position.x = (x - Tetris.boundingBoxConfig.splitX/2)*Tetris.blockSize + Tetris.blockSize/2;
If you require additional code snippets for further context, please let me know so I can provide them. Any assistance would be greatly appreciated! Constructive criticism only, please.
EDIT: Here is the definition of the Tetris Object:
var Tetris = {};
Another suggested method was:
window.Tetris = window.Tetris || {};
However, I'm unsure about how this specific approach functions.
EDIT 2:
I'm not certain if this information helps clarify the issue:
var boundingBox = new THREE.Mesh(
new THREE.CubeGeometry(
boundingBoxConfig.width, boundingBoxConfig.height, boundingBoxConfig.depth,
boundingBoxConfig.splitX, boundingBoxConfig.splitY, boundingBoxConfig.splitZ),
new THREE.MeshBasicMaterial( { color: 0xffaa00, wireframe: true } )
);
Tetris.scene.add(boundingBox);