RookieDev The trick is to make your tiles all over the map, except at the top (because you want some surface) http://i.imgur.com/dinYKeO.png Then you add "Erasers"(Which i like to call them) http://i.imgur.com/WKsx1aM.jpg Which are the pink/purple circles or whatever you wanna colour them just make sure they are invicible during game. Then you make each of them individual so they don't erase in the same pattern. After that, you goto your event sheet, and make a global variable which you may call "RandomGen", just give it variable = 0.
Make a group, which you may call "ERASERTOTAL" And inside you make more Groups (Depending on how many eraser you have. http://i.imgur.com/92nBeaD.png. I for an instance has 6 to begin with, but i only use 3 of them + an extra eraser.
Do: System Every Tick -> System Set RandomGen to = round(random(0,7))
Inside your Eraser group:
(Make sure your eraser has "Bullet" behaviour.
Do: System Check Variable = 0 -> ERASER1 Set angle + degrees
Do: System Check Variable = 1 -> ERASER1 Set angle + degrees
Do: System Check Variable = 2 -> ERASER1 Set angle + degrees
Do: System Check Variable = 3 -> ERASER1 Set angle + degrees
Do: System Check Variable = 4 -> ERASER1 Set angle + degrees
Do: System Check Variable = 5 -> ERASER1 Set angle + degrees
Do: System Check Variable = 6 -> ERASER1 Set angle + degrees
Do: System Check Variable = 7 -> ERASER1 Set angle + degrees
Do: On start of layout -> System (for example) Wait 5 seconds
ERASER1 Set Bullet speed to 400
ERASER1 Set scale to 0.5
Wait 15 seconds
(You could do anything you want for that one, but i did it like this to make it a bit more random and make the terrain look abit more nice)
Now do the same for all of your Erasers.
!!REMEMBER TO CHANGE Which "RandomGen" number that active certain angle for each of your erasers or else they will all do the same erasing!!
To make it even more random:
Instead of making a new global variable for that one, you could just use the "RandomGen" global variable.
At the beginning of the layout, you don't want to show the players how the map is generated, so make sure the tiles and erasers are invicible at the bery beginning.
Make a group called (for example): "GenerateInfo"
Create "Text" which you may call "LoadInfo"
Inside it will look like this. http://i.imgur.com/wcHHJIQ.png
Every 1 second you set "Generating: (add 5%)"
Do this 20 times, at the end you make "LoadInfo" Set Invicible.
At the picture you can see that i did chagne something, and added an another second, but that is bcause i have some delays with the erasers and random ore placing.
Now for the Ore's
You make theese pink circles, which will be spawned random all over the map at the end of the generating process (Make sure the map is finished erased before making the Ore gen appear).
Make sure you give the dirt/stone.etc(tiles you wanna replace with ores...) an variable. (ID=0)
Whenever an Ore is above a tile, the tile will change ID. (For example) DirtID = 0. "Random CoalGen appear" DirtID = 1 (Which will turn the Dirt to a coal ore. and you can watch the picture to see how it's made.
That is mostly it, but you also want the dirt on surface to become grass.
Make spawners at the whole top layer of the map, which spawns "Seeds" At all time. Whenever a seed hit the dirt, the seed destroy itself, and the grass change ID to a grass ID.
You also need to make sure the map get visible after the generating, you need to time the Seconds needed to generate the map, which you also need to put dealys on the LoadInfo! I hope this rough tutorials made some sense, in worst case i could make my capx downloadable, but id like to have it myself, becuase i plan to upload it to scirra arcade soon ;)