TileMap.gd 522 B

123456789101112131415161718192021222324
  1. tool
  2. extends TileMap
  3. export var do_it = false
  4. func please_do_it():
  5. var all_cells = get_used_cells()
  6. for coords in all_cells:
  7. var cell = get_cell(coords.x, coords.y)
  8. var target = 9
  9. if int(abs(coords.x)) % 2 == 1:
  10. target += 1
  11. if int(abs(coords.y)) % 2 == 1:
  12. target += 2
  13. if cell >= 9 and cell <= 12:
  14. print(str(coords.x) + " " + str(coords.y) + " " + str(target))
  15. set_cell(coords.x, coords.y, target)
  16. func _process(_delta):
  17. if Engine.editor_hint:
  18. if do_it:
  19. please_do_it()
  20. do_it = false