Make water generate on surface

This commit is contained in:
jordan4ibanez 2017-07-08 04:11:06 -04:00
parent 80f3ca74cc
commit 0b7a5a8928
2 changed files with 6 additions and 1 deletions

View File

@ -24,6 +24,9 @@ earth_max = 2
--max chunks loaded ( chunk x chunk ) --max chunks loaded ( chunk x chunk )
max_chunks = 3 max_chunks = 3
--water height on the surface
water_height = 10
--makes player move to next map section --makes player move to next map section
function maplib.new_block(oldposx,oldposy) function maplib.new_block(oldposx,oldposy)
if player.playerx < 1 then if player.playerx < 1 then
@ -189,6 +192,8 @@ function maplib.createmap()
--generate dirt as debug --generate dirt as debug
if y == yer then if y == yer then
tiles[x][y]["block"] = 4 tiles[x][y]["block"] = 4
elseif y < yer and y >= water_height then
tiles[x][y]["block"] = 5
elseif y < yer then elseif y < yer then
tiles[x][y]["block"] = 1 tiles[x][y]["block"] = 1
else else

View File

@ -35,7 +35,7 @@ function love.keypressed( key, scancode, isrepeat )
--debug --debug
if key == "f5" then if key == "f5" then
chunkx,chunky = math.random(-1000,1000),math.random(0,3) chunkx,chunky = math.random(-1000,1000),math.random(2,3)
maplib.createmap() maplib.createmap()
--print("generate random block") --print("generate random block")