Here's a current screenshot of my game, "Mine to the sky". My game builds levels using 32 x 32 tile templates and compiles them into a 2D array that is 128 x 128, like the image attached below. This array holds values of 0(air) and 1(dirt).
Really want to add different harder to break types of dirt blocks to the existing generated levels, but I'm having some trouble with trying to generate a height map from an existing 2D Array. I'm not sure how I could generate a height map with the existing 2D array "Mask".
I'd like to figure out how to do something like this with the dirt blocks, but figuring out how to do it with an array that's already been generated is a big headache.
Basically lets say I have a map like this, but with a more randomized pattern.
[
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 1, 1, 1, 1, 1, 1, 1, 0],
[0, 1, 1, 1, 1, 1, 1, 1, 0],
[0, 1, 1, 1, 1, 1, 1, 1, 0],
[0, 1, 1, 1, 1, 1, 1, 1, 0],
[0, 1, 1, 1, 1, 1, 1, 1, 0],
[0, 1, 1, 1, 1, 1, 1, 1, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0]
]
How would I make it so it had a "peak" in it's data that gradually sloped down until it hit "air"?
Something like this, but with a more randomized pattern.
[
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 1, 1, 1, 1, 1, 1, 1, 0],
[0, 1, 2, 2, 2, 2, 2, 2, 0],
[0, 1, 2, 3, 3, 3, 3, 2, 0],
[0, 1, 2, 3, 3, 3, 3, 2, 0],
[0, 1, 2, 2, 2, 2, 2, 2, 0],
[0, 1, 1, 1, 1, 1, 1, 1, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0]
]
If anyone has any suggestions I would really appreciate it.