aboutsummaryrefslogtreecommitdiffstats
path: root/Scripts
diff options
context:
space:
mode:
authorAndy Belle-Isle <drumsetmonkey@gmail.com>2019-09-11 00:24:32 -0400
committerAndy Belle-Isle <drumsetmonkey@gmail.com>2019-09-11 00:24:32 -0400
commitb46aa08e48bdfa9008738ed5d599d6e7d11ede56 (patch)
tree58890900737f49607865817135c9805ada3730d4 /Scripts
parent2349bd2ffdd7b312c4b13e5794f12d2b7613f3b4 (diff)
Made world generation a bit nicer
Diffstat (limited to 'Scripts')
-rw-r--r--Scripts/world.lua17
1 files changed, 13 insertions, 4 deletions
diff --git a/Scripts/world.lua b/Scripts/world.lua
index db0dc70..1157704 100644
--- a/Scripts/world.lua
+++ b/Scripts/world.lua
@@ -1,27 +1,36 @@
world = {
Registry = {
+ grass = {
+ id = 0,
+ texture = "Assets/grass.png",
+ normal = "Assets/grass_normal"
+ },
dirt = {
- id = "world0:dirt",
+ id = 1,
texture = "Assets/dirt.png",
normal = "Assets/dirt_normal.png"
},
stone = {
- id = "world0:stone",
+ id = 2,
texture = "Assets/stone.png",
normal = "Assets/dirt_normal.png"
}
},
Seed = 5345345,
- Layers = 3,
+ Layers = 2,
Generate = function(self)
+ math.randomseed(self.Seed)
self.data = {}
- for Z = 0,2 do
+ for Z = 0,self.Layers do
self.data[Z] = {}
for X = 0,250 do
self.data[Z][X] = {}
YGen = math.floor(6*math.sin(X/20) + Z) + 64
+ YDepth = math.random(2,5)
for Y = 0,128 do
if Y == YGen then
+ self.data[Z][X][Y] = 0
+ elseif Y < YGen and Y > (YGen - YDepth) then
self.data[Z][X][Y] = 1
elseif Y < YGen then
self.data[Z][X][Y] = 2