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():
noise = OpenSimplexNoise.new()
noise.seed = randi()
noise.octaves = 3
noise.period = 18
noise.persistence = 0.8

func chunk(chunkwidth,chunklength,chunkdepth):
for x in chunk
for y in chunkdepth:
for z in chunk
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
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)

in Engine by (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.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.