I want to generate a dynamic tileLayer that takes its tileSet from configurable settings. Is this even possible? Obviously, the normal mode is to load a tilemap, but I’m wondering if I can generate this dynamically using some combination of graphics / renderTextures
Was thinking I could do something like:
this.texture = scene.add.renderTexture(0, 0, 200, 200);
this.texture.draw(this.customGraphic); // A square graphic, with configurable "fill"
this.texture.saveTexture('test-id');
My understanding was that this adds the “test-id” to the system TextureManager
. But if I use this later in creating the tileLayer like so
tileMap.addTilesetImage('tile-set-name', 'test-id', tileWidth, tileHeight);
that blows up the Game, with the error:
WebGL: INVALID_OPERATION: bindTexture: attempt to use a deleted object