[SOLVED] Need Desperate Help

G

GrizzlyTech

Guest
I've been trying to make my game auto-tile sprites now for the last 15 hours, I tried posting this earlier on the forums and reddit page to see if anyone knows how to program this, and haven't gotten anything so far...

Basically, there are 13 sprites. 2 wall tiles, 2 floor tiles, 4 corner tiles, 4 inside corner tiles and one middle tile.

I'd like to be able to place down one object and then have it set the correct sprite depending on where its position is relative to others of the same object.

I've seen a lot of tutorials on this, but most of them either use too many tiles or too little. There doesn't seem to be one for this 13 tile set.

This is what the 13 tiles look like, as well as examples of how they'd ideally look once auto-tiled.


Extra Code info:
image_index 0 = Middle Tile
image_index 1 = Left Wall
image_index 2 =Right Wall
image_index 3 = Floor
image_index 4 = Ceiling
image_index 5 = Top Left Corner
image_index 6 = Top Right Corner
image_index 7 = Bottom Left Corner
image_index 8 = Bottom Right Corner
image_index 9 = Inner Top Left Corner
image_index 10 = Inner Top Right Corner
image_index 11 = Inner Bottom Left Corner
image_index 12 = Inner Bottom Right Corner

Thanks so much to anyone who knows how to do this.
 

Laura Bravo

Member
So you need to check the surrounding areas, looks to be 8dir check for this to determine what is free and what is not.
dir_u = 0; //1 if something there
dir_ur = 0;
And so on
After all objects/areas have verified their surroundings you need to go through all possibilities and make the correct tile fit.
to save some time you can simply change somethings that will get changed again down the code such as
Make the area = floor no walls to start
than check the 4 corners and make it a corner piece. If there are walls than they will undue corner so no need to check for corners after this
add up all side walls. if =1 than check which for 1 side wall if 2 than run checks for 2 side walls.
 
Top