GMS 2 Copy Tilemap Delete Remake, Set All/Invert Properties

If I want gather a tilemap delete and remake it from info I store in an object. What's the best way to do this? I could loop through the tilemap data and set each property with tile_get_flip(tiledata), tile_get_rotate(tiledata), ect. This is sort of working for me, but would using the tilemap mask would be better? It doesn't seem to work, and I'm not sure how to use it. I'm guessing the tilemap_set_mask can return the tile properties to their correct value, but can they set them all in one direction or the other, or invert their value and how would you write theses?

I've tried to use the Manual code example for tilemap_get_mask(tilemap_element_id) with tilemap_clear(map_id, 0) added , after clearing then resetting the tilemap all but 1 tile disappears, and it losses it's rotation value.


var lay_id = layer_get_id("Tiles_Sky");
var map_id = layer_tilemap_get_id(lay_id);
var mask = tilemap_get_mask(map_id);
var new_mask = tile_mirror | tile_flip | tile_rotate| 255;

tilemap_clear(map_id, 0)

if mask != new_mask
{
tilemap_set_mask(map_id, new_mask);
tilemap_set(lay_id,map_id,0,0)
}


Would you write setting them all in a direction like this, or some other way?

new_mask = 1 | 1 | 1 | 255

Would reversing work like this?

new_mask = !tile_mirror | !tile_flip | !tile_rotate | 255;

What values do the place where tile_mirrior, tile_flip, and tile_rotate are actually take?
 
Top