var = 0
world = []
blocks = {"smooth_rock":0,"cobble_stone":36,"moss_stone":39,"bone_ore":1,"coal_ore":2,"iron_ore":18,"gold_ore":20,"diamond_ore":19,"iron_block":36,"diamond_block":37,"gold_block":52,"bone_block":53,"coal_block":54,"dirt":21,"grass_dirt":3,"coal_dirt":4,"bone_dirt":22,"grass":5,"high_grass":6,"grass_block":7,"pumpkin":13,"face_pumpkin":14,"wood":9,"leaf":10,"plank":11,"red_flower":23,"white_flower":24,"plant":43,"mushroom":25,"white_mushroom":41,"stone":42}
set_block = function(xpos,ypos,block)
tiles.setCell xpos,ypos,block
end function
display(5).mode = displayMode.sprite
background = display(5)
background.clear
back = new Sprite
back.image = file.loadImage("background.png")
background.sprites.push back
back.x = 1186
back.y = 320
back.scale = 2.9
display(4).mode = displayMode.tile
tiles = display(4)
tiles.clear
tiles.scrollX = 3
tiles.tileSet = file.loadImage("terraTile.png")
tiles.tileSetTileSize = 8
tiles.cellSize = 70
tiles.extent = [101,101]
setChunk = function(block,lenght=0,width=0)
display(4).clear
while 101 > width
if 95 > width then
while 16 > lenght
block = floor(rnd30)
if block == 0 then
set_block lenght,width,blocks.bone_ore
else if block == 1 then
set_block lenght,width,blocks.coal_ore
else if block == 2 then
set_block lenght,width,blocks.iron_ore
else if block == 3 then
set_block lenght,width,blocks.diamond_ore
else if block == 4 then
set_block lenght,width,blocks.gold_ore
else
set_block lenght,width,blocks.smooth_rock
end if
lenght = lenght + 1
end while
lenght = 0
width = width + 1
else if width > 92 and 95 > width then
while 16 > lenght
block = floor(rnd30)
if block == 0 then
tiles.setCell lenght,width,blocks.coal_ore
else if block == 1 then
tiles.setCell lenght,width,blocks.iron_ore
else if block == 2 then
tiles.setCell lenght,width,blocks.coal_dirt
else if block == 3 then
tiles.setCell lenght,width,blocks.bone_dirt
else
tiles.setCell lenght,width,blocks.smooth_rock
end if
lenght = lenght + 1
end while
lenght = 0
width = width + 1
else if width > 94 and 97 > width then
while 16 > lenght
block = floor(rnd5)
if block == 0 then
tiles.setCell lenght,width,blocks.dirt
else if block == 1 then
tiles.setCell lenght,width,blocks.smooth_rock
else
tiles.setCell lenght,width,blocks.cobble_stone
end if
lenght = lenght + 1
end while
lenght = 0
width = width + 1
else if width > 96 and 99 > width then
while 16 > lenght
block = floor(rnd20)
if block == 0 then
set_block lenght,width,blocks.cobble_stone
else
set_block lenght,width,blocks.dirt
end if
lenght = lenght + 1
end while
width = width + 1
lenght = 0
else if width == 99 then
while 16 > lenght
set_block lenght,width,blocks.grass_dirt
lenght = lenght + 1
end while
lenght = 0
width = 100
else if width == 100 then
while 16 > lenght
block = floor(rnd*30)
if block == 0 then
set_block lenght,width,blocks.grass
else if block == 1 then
set_block lenght,width,blocks.high_grass
else if block == 2 then
set_block lenght,width,blocks.red_flower
else if block == 3 then
set_block lenght,width,blocks.white_flower
else if block == 4 then
set_block lenght,width,blocks.plant
else if block == 5 then
set_block lenght,width,blocks.mushroom
else if block == 6 then
set_block lenght,width,blocks.white_mushroom
else if block == 7 then
set_block lenght,width,blocks.pumpkin
end if
lenght = lenght + 1
end while
width = 101
end if
end while
end function
<