Essentially, I’d like to have a plane with a highly pixelated textures on it (maybe 32x32, no aliasing or anything). That texture could be updated via a script. Maybe the “cell” at 5,9 went from green to red?
Or is there a better way to do a tile-based game in PlayCavas?
var pixels = this.texture.lock();
var index = 0;
for (var x = 0; x < 32; x++) {
for (var y = 0; y < 32; y++) {
// Set pixel to some color as you like...
pixels[index] = x;
pixels[index+1] = y;
pixels[index+2] = 255;
index += 3;
}
}
this.texture.unlock();