experimented some more and was able to make a minecraft2d-ish thing, but still my approach is pretty clumsy. Here is a cap-
the concept is pretty simple, generate the next tile depending upon the position of the previous one.
Alter with the values of 'store' var to generate different types of terrain.
right now it's not looking good since i am unable to generate the tiles beneath the grass tiles.
(I tried once but the events for that are toggled off, since it slows down everything)