//Checks in the tile sheet if the tile is specified as a "solid" tile
//Expand this conditional for each "solid" tile in the tile sheet
tile_id = tile_layer_find(1000000,xx*16,yy*16);
if tile_id > -1 && !collision_line((xx)*16,yy*16,xx*16,yy*16,prt_ground,0,0)
{
if (tile_get_left(tile_id)=0 && tile_get_top(tile_id)=0)
{
brick=instance_create(xx*16,yy*16,prt_ground);
span=0;
with(brick)
{
tile_id=tile_layer_find(1000000,x+span*16,y);
while (tile_id>-1)
{
//Checks if adjacent tiles are "solid" tiles according to the tile sheet
if tile_get_left(tile_id)=0 && tile_get_top(tile_id)=0
{
image_xscale=span+1;
span+=1;
tile_id=tile_layer_find(1000000,x+span*16,y);
}
else tile_id=-1;
}
span=0;
tile_id=tile_layer_find(1000000,x,y+span*16);
while (tile_id>-1)
{
if tile_get_left(tile_id)=0 && tile_get_top(tile_id)=0
{
image_yscale=span+1;
span+=1;
tile_id=tile_layer_find(1000000,x,y+span*16);
}
else tile_id=-1;
}
}
}
}
This is the "non-engine" format I guess. >_> You can look through it and see how I did everything. In this case, no tiles are deleted. This also includes the more efficient version of the block placer whereby the block object gets stretched out. Test it, make sure it works right. If you have suggestions, let me know. The code isn't "perfect" because I think I gave vertical checks priority over horizontal checks, since you're more likely to find vertically long walls. This code has should have little effect on stairs, although it just occurred to me that the following would be less efficient than my old code:
A ■■■■■■■■ B ■■■
■■■■■■■■■■■ ■■■■■■
■■■■■■■■■■■■■ ■■■■■■■■
In A, it would create 7 blocks I think. In B, I think it would create 4 blocks. In both cases, the old code would have made 3 blocks. ... I think. I need to test that out. I could be wrong and it could work just fine as is, maybe. {EDIT: Actually, as the code is now, it works fine in both cases with no change in the number of block objects created, however the objects would overlap in the primary corner, which may just be wasteful or it may also create future bugs.} Also, in my code, it creates overlapping blocks. Also, in cases where you have niches in a wall on the right-hand side, this would make the niche solid too. So yes, there are still some glitches in my "efficient" version, although for the MOST part it is more efficient.