diff options
author | Andy Belle-Isle <drumsetmonkey@gmail.com> | 2019-09-07 03:14:26 -0400 |
---|---|---|
committer | Andy Belle-Isle <drumsetmonkey@gmail.com> | 2019-09-07 03:14:59 -0400 |
commit | a5af0d986ca40c592580dbe743a3adb0cfd476de (patch) | |
tree | 9ca08e33206f8197e99ee636f014150f21cceb05 | |
parent | 2417abe35038e903bf63d996ae6252173aa878a2 (diff) |
Started extremely basic world generation
-rw-r--r-- | Scripts/init.lua | 8 | ||||
-rw-r--r-- | Scripts/world.lua | 35 |
2 files changed, 37 insertions, 6 deletions
diff --git a/Scripts/init.lua b/Scripts/init.lua index 1292ba1..f177462 100644 --- a/Scripts/init.lua +++ b/Scripts/init.lua @@ -156,6 +156,8 @@ game.spawn({ end }); +dofile("Scripts/world.lua") + ------------------- -- SERIALIZING -- ------------------- @@ -183,9 +185,3 @@ f2("shite") local testPut = string.dump(animalSpawn.TestMe) testRun = (loadstring or load)(testPut) testRun(animalSpawn) - ---blah = load(serial(hello)) ---blah() - ---draw = loadstring("\027\076\074\001\000\009\064\109\097\105\110\046\108\117\097\084\000\000\004\000\004\000\008\009\002\002\052\000\000\000\055\000\001\000\055\000\002\000\037\001\003\000\039\002\010\000\039\003\010\000\062\000\004\001\071\000\001\000\017\104\101\108\108\111\044\032\119\111\114\108\100\010\112\114\105\110\116\013\103\114\097\112\104\105\099\115\009\108\111\118\101\001\001\001\001\001\001\001\002\000\000") ---draw() diff --git a/Scripts/world.lua b/Scripts/world.lua new file mode 100644 index 0000000..db0dc70 --- /dev/null +++ b/Scripts/world.lua @@ -0,0 +1,35 @@ +world = { + Registry = { + dirt = { + id = "world0:dirt", + texture = "Assets/dirt.png", + normal = "Assets/dirt_normal.png" + }, + stone = { + id = "world0:stone", + texture = "Assets/stone.png", + normal = "Assets/dirt_normal.png" + } + }, + Seed = 5345345, + Layers = 3, + Generate = function(self) + self.data = {} + for Z = 0,2 do + self.data[Z] = {} + for X = 0,250 do + self.data[Z][X] = {} + YGen = math.floor(6*math.sin(X/20) + Z) + 64 + for Y = 0,128 do + if Y == YGen then + self.data[Z][X][Y] = 1 + elseif Y < YGen then + self.data[Z][X][Y] = 2 + end + end + end + end + end +} + +world:Generate() |