0 votes

Hi, I am trying make a game like Minecraft but have trouble making the terrain[ Hills , Mountains , etc ] and making the dirt blocks below the Grass Blocks

enter image description here

Here's The Source Code

extends Spatial

enum Blocks {Dirt,Grass,Stone}
var groundsize = Vector3(10,10,10)
var next
chunk_coord = Vector3(0,0,0)
var noise
onready var map = $World/GridMap

func ready():
randomize()
noise = OpenSimplexNoise.new()
noise.seed = randi()
noise.octaves = 3
noise.period = 18
noise.persistence = 0.8
chunk(ground
size.x,groundsize.y,groundsize.z)

func chunk(chunkwidth,chunklength,chunkdepth):
for x in chunk
width:
for y in chunkdepth:
for z in chunk
length:
var final = 0
var a = noise.getnoise3d(x,y,z + nextchunkcoord.z)
#var a = noise.getnoise1d(y)
if a < 0.02:
final = Blocks.Dirt
elif a >=0.02 and a < 0.4 :
final = Blocks.Grass
elif a >=0.4 and a < 0.7:
final = Blocks.Stone
else:
final = Blocks.empty()
for num in range(0,z):
map.setcellitem(x,y,z + nextchunkcoord.z,final)
nextchunkcoord.z += chunk_length

I only used Gridmaps and a camera(for the preview)

asked Jun 18 in Projects by Tarun (14 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.