- Home /
Generating a 2D map out of a tileset problem. Array and If statements. HELP!
I have a script that analyzes an image and places tiles of a tileset depending on what color is on which pixel of the level map image. I found the script from a youtube tutorial found here (https://www.youtube.com/watch?v=5RzziXSwSsg) I was trying to figure out an easy way to have the script manage a tileset with multiple tiles dedicated for one color. I want it to be able to know where to place a corner or edge or center without having to make separate colors for all the different angles and edges. I thought maybe I could check all the surrounding pixels and see what color they are to know which tile to use but then I would have to program in like 27 different if statements that compare all the surrounding pixels to the one I want to place. there has to be an easier way to do this. so far I have an array of color32 that stores all the pixels surrounding the one to be placed and I have more than 27 different tiles that could be placed depending on the surrounding pixels. Please help me find an easier way to go about this.