Skip to content

Commit

Permalink
Add cave generator
Browse files Browse the repository at this point in the history
  • Loading branch information
Janorico committed May 25, 2023
1 parent 57af2d1 commit d9c4818
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion scenes/startup.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ margin_top = 36.0
margin_right = 289.0
margin_bottom = 64.0
text = "Forest"
items = [ "Forest", null, false, 0, null, "Desert", null, false, 1, null, "Boreal", null, false, 2, null ]
items = [ "Forest", null, false, 0, null, "Desert", null, false, 1, null, "Boreal", null, false, 2, null, "Cave", null, false, 3, null ]
selected = 0

[node name="DeleteConfirmation" type="ConfirmationDialog" parent="."]
Expand Down
16 changes: 16 additions & 0 deletions scripts/game/chunk_generators/CaveGenerator.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
extends ChunkGenerator


static func generate_surface(height, _x, y, _z):
var type
if y == height - 1:
type = "Grass"
elif y == height -2:
type = "Dirt"
elif y == height - 3 or y == height - 4:
type = "Stone"
elif y < height - 14:
type = "Stone"
else:
type = "Air"
return type

0 comments on commit d9c4818

Please sign in to comment.