Jump to content

Regenerate texture in render()


talamask
 Share

Recommended Posts

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!

map.png

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...