Advertisement
mokesmoe

Half-tile autotile example

Jan 19th, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.67 KB | None | 0 0
  1. Set up tiles like this: (inside corners to the right)
  2. ┌───  ────  ───┐  
  3. │              │     ┌  ┐
  4.  
  5. │              │     └  ┘
  6. │              │
  7.  
  8. │              │
  9. └───  ────  ───┘
  10.  
  11. x = 1
  12. y = 1
  13.  
  14. //check left/right
  15. if(left is open) x = 0
  16. else if(right is open) x = 2
  17.  
  18. //check up/down
  19. if(up is open) y = 0
  20. else if(down is open) y = 2
  21.  
  22. //special case for inside corners
  23. if (x == 1 && y == 1){
  24.     if(top left is open){x = 4; y = 1}
  25.     else if(top right is open){x = 3; y = 1}
  26.     else if(bottom left is open){x = 4; y = 0}
  27.     else if(bottom right is open){x = 3; y = 0}
  28. }
  29.  
  30. use the tile at position x,y
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement