How I created the Terrain. I followed a really great tutorial, Procedural Generation for Beginners Tutorial by abhilash2863. Full credit goes to him for an awesome PDF he put together on procedural generation.
Create an Array.
Assign each X & Y element a random integer from 1-20.
Assign each X element in the Y element 0 to integer 21.
If an elements number is less than 13 create object Terrain and set animation to dirt.
If an elements number is 14-18 create object Terrain and set animation to rock.
If an elements number is 19-20 create object Terrain and set animation to gold.
If an elements number is 21 create object Terrain and set animation to grass.
All of this runs on Start of Layout so every time the level is loaded this runs and assigns new random numbers excluding the top of the Terrain which is always set to 21 which will be grass. The underground however is always randomly generated so it will never be the same.
So with a single sprite object, Terrain, I was able to assign it multiple animations. Animation Rock, Grass, Dirt, Gold, and each animation is a single frame of Grass, Rock, Dirt, or Gold. I was then able to assign instance variables to the Terrain object. GoldHealth, DirtHealth,GrassHealth, and RockHealth. When you hit something the events check to see which animation is currently playing if it is currently playing rock animation and you hit it then subtract 1 from rock health. If Rockhealth is equal to 0 then destroy Terrain object. So on for the rest excluding gold in that is GoldHealth = 0 then destroy Terrain object and add 1 to a Global Variable called Gold. Which is a counter that keeps track of how much gold you currently have.
So that's pretty much the main bulk of the Terrain code.