PDA

View Full Version : Getting all layers and Saving the level


sssssssssss
10-11-2013, 12:40 AM
I'm trying to get all the layers of a level and save as an image. I can get a specific layer just fine, but trying to get them all on one image seems to have stumped me. If I take out the temp.r loop, change the @= for temp.tile to just =, and set tilelayers[0] then it works fine one 1 layer. I know I'm just doing this wrong probably, but if it's even possible I can't wrap my head on how to do it. Using dustys TileLayers script btw.


for (temp.i = 0; temp.i < 64; temp.i++) {
for (temp.k = 0; temp.k < 64; temp.k++) {
temp.tilex = i;
temp.tiley = k;

for (temp.r = 0; temp.r < 6; temp.r++) {
temp.tile @= tilelayers[r].tiles[temp.tilex, temp.tiley];
temp.imagetile = TilesToImage(temp.tile);
}
temp.tilesetImage = "roak_tileset_gmap_overworld.png";

this.levelImg.drawimagestretched(i * 16, k * 16, 16, 16, temp.tilesetImage, temp.imagetile[0], temp.imagetile[1], 16, 16);
}
}


(I started out using it in the control, but it just wouldn't work, so I had to put the control in a var)

I also might as well ask how to do this with a gmap instead of just one level as well, obviously I'm trying to just draw out the map per the levels and layers.

fowlplay4
10-11-2013, 01:09 AM
Wouldn't this do what you want?


temp.tilesetImage = "roak_tileset_gmap_overworld.png";
for (temp.i = 0; temp.i < 64; temp.i++) {
for (temp.k = 0; temp.k < 64; temp.k++) {
temp.tilex = i;
temp.tiley = k;

for (temp.r = 0; temp.r < 6; temp.r++) {
temp.tile = tilelayers[r].tiles[temp.tilex, temp.tiley];
temp.imagetile = TilesToImage(temp.tile);
this.levelImg.drawimagestretched(i * 16, k * 16, 16, 16, temp.tilesetImage, temp.imagetile[0], temp.imagetile[1], 16, 16);
}
}
}

sssssssssss
10-11-2013, 02:38 AM
No unfortunately, anything with the temp.r loop won't even get to the point of saving the image, probably because of the way dustys tile functions work, and his thing he made is way out of my league so if there isn't another way I suppose I'm doomed.

fowlplay4
10-11-2013, 01:52 PM
Increase the loop limit, I.e.

maxlooplimit = 100000;

64*64*6 is 24576 which is over the 10000 limit by default.

sssssssssss
10-12-2013, 02:50 AM
tried this.maxlooplimit = 100000; and maxlooplimit = 100000; before and, just for kicks, in the loop. Nothing.