talamask Posted November 6, 2018 Share Posted November 6, 2018 Hello In Phaser 3.15 I am creating a texture using this.textures.generate passing an array of string arrays based on heights I generated with Perlin noise like this: create() { this.textures.generate("map", { data: textureMap, pixelWidth: 5, pixelHeight: 5, palette: palette }); this.add.image(0, 0, "map").setOrigin(0); } Result can be viewed in attachment. How can I regenerate this texture in update() function based on another textureMap data? I understand that it can be inefficient to do it each frame, but I just want to know how to do it. If I try directly to generate and add image with the same key Phaser complains that Texture key already in use: map Thank you! Link to comment Share on other sites More sharing options...
GreenCloversGuy Posted November 6, 2018 Share Posted November 6, 2018 https://photonstorm.github.io/phaser3-docs/Phaser.Textures.TextureManager.html#remove__anchor Couldn't see a way to directly modify the texture source, easiest way is to destroy the key/texture pair before generating another texture. Link to comment Share on other sites More sharing options...
Recommended Posts