If you wnat to see the code of this 2D space take a look at this and see how it principally works ^^
It is kind of buggy and still needs some improvement because in some cases it takes the wrong tiles... But i won't improve it anymore because this was just a test a year ago...