Let\'s say I have this image:
and I have this 2D array tiles[]>
ok I did this on my localhost: it should give you a base at least. I think you should be able to use this straight outta the box but you might have to make a few calculation adjustments for it depending on what you want. I just don't think it's neccessary to spend thee time to perfect it to your example:
You'll obviously have to point the image to your own image.