If you want to write this code, what you absolutely should do is to make a library that lets users configure them in one simple step:
Step 1: Tile zone objects. Give 4 coordinates, get a tile zone object back that can be used for grouping tile changes.
Looks like this:
Code: Select all
local myZone = worldswapper.createZone(name, left, top, right, bottom)
Notice how I said one step. That's because, in general scenarios, this is all you want users to have to do. The name is the key here. Using the name you can dynamically load all images that use the name. Take a zone with name "desert". And in your folder you then put stuff like:
tile-329-desert.png
path-24-desert.png
Find them automatically.
If you need further functionality you can build on the zone object that is returned. Imagine for example myZone.addArea(left, top, right, bottom) which lets you define another rectangle for the specified tiles.