I am currently developing a semi-OOP game and utilizing EaselJS as my chosen library. While I have made significant progress, I have encountered a persistent issue that is proving to be quite troublesome. The problem arises when I attempt to render out my tiles, as the tile container seems to be malfunctioning. It refuses to recognize the type "array" for some unknown reason. Here is the code snippet in question:
(function() {
var tile = function(array, _x, _y, spritesheet) {
this.initialize(array, _x, _y, spritesheet);
}
tile.prototype = new createjs.Container();
tile.prototype.Container_initialize = this.initialize(array, _x, _y, spritesheet);
tile.prototype.initialize = function(array, _x, _y, spritesheet) {
this.Container_initialize();
this.x = _x * 120;
this.y = _y * 120;
this.tileArray = array;
this.tilesheet = spritesheet;
for (var x = 0; x < this.tileArray.length; x++)
{
for (var y = 0; y < this.tileArray.length; y++)
{
console.log(this.tileArray[x][y]);
var tileSprite = new createjs.Sprite(this.tilesheet, this.tileArray[x][y]);
tileSprite.x = _x * 40 * x;
tileSprite.y = _y * 40 * y;
}
}
}
window.tile = tile;
}());