GMS 2 How to do Inner Tileset Corners.

Hey! I am currently working on a project, and I watched this video [
] on how to make AutoTiling on objects. This video shows how to do the outsides, but not the insides of the Tiles (As in the inner corners). The code will be down below for the autoTiling script, any help is appreciated. I also asked in the comments a few weeks ago, with no answer, so I came here. Thanks!

P.S: The image below can help with the code.


AutoTiling Script:
WR = Tile right side
WL = Tile left side
WU = Tile top
WD = Tile bottom
Code:
BS = sprite_width;        //Base Size
image_speed = 0;

WR = position_meeting(x + BS, y, oDirt);
WL = position_meeting(x - BS, y, oDirt);
WU = position_meeting(x, y - BS, oDirt);
WD = position_meeting(x, y + BS, oDirt);

if (!WL and !WU and !WD and !WR)
    image_index = 0;
else if (!WL and !WU and WR and WD)
    image_index = 1;
else if (WR and WL and !WU and WD)
    image_index = 2;
else if (WL and WD and !WR and !WU)
    image_index = 3;
else if (!WR and WL and WU and WD)
    image_index = 4;
else if (WU and WL and !WR and !WD)
    image_index = 5;
else if (WL and WR and WU and !WD)
    image_index = 6;
else if (!WL and !WD and WU and WR)
    image_index = 7;
else if (!WL and WU and WD and WR)
    image_index = 8;
else if (WL and WR and WD and WU)
    image_index = 9;
else if (!WL and !WU and !WD and WR)
    image_index = 10;
else if (WL and !WU and !WD and WR)
    image_index = 11;
else if (WL and !WU and !WD and !WR)
    image_index = 12;
else if (!WL and !WU and !WR and WD)
    image_index = 13;
else if (!WL and !WR and WU and WD)
    image_index = 14;
else if (!WL and !WR and !WD and WU)
    image_index = 15;
Also here is the image of the tiles with helpful info:


Original Tileset:
 

TailBit

Member
You simply need to expand on this part:
Code:
    image_index = 9;
in that section, check the diagonal tiles.
 

TailBit

Member
Well, you add or subtract the BS to find the horizontal and diagonal
Code:
WR = position_meeting(x + BS, y, oDirt);
so now you just need to do it with both coordinates
Code:
WRU = position_meeting(x + BS, y - BS, oDirt);
So it would be something like:
Code:
else if (WL and WR and WD and WU){
   WRU = position_meeting(x + BS, y - BS, oDirt);
   WRD = position_meeting(x + BS, y + BS, oDirt);

    if( !WRU ) image_index = 18; else
    if( !WRD ) image_index =16; else
   image_index = 9;
}else if (!WL and !WU and !WD and WR)
then you just need to add the last 2
 
Well, you add or subtract the BS to find the horizontal and diagonal
Code:
WR = position_meeting(x + BS, y, oDirt);
so now you just need to do it with both coordinates
Code:
WRU = position_meeting(x + BS, y - BS, oDirt);
So it would be something like:
Code:
else if (WL and WR and WD and WU){
   WRU = position_meeting(x + BS, y - BS, oDirt);
   WRD = position_meeting(x + BS, y + BS, oDirt);

    if( !WRU ) image_index = 18; else
    if( !WRD ) image_index =16; else
   image_index = 9;
}else if (!WL and !WU and !WD and WR)
then you just need to add the last 2
Alright thanks for your help!
 
Top