0 Members and 1 Guest are viewing this topic.
I too prefer the side-view style for a game such as this. Do you plan to have some sort of field of view code, or something equivalent such that people can only see area's they have been in before? I think that would be cool and useful, and it would make exploring caves and stuff more interesting because you don't necessarily know what is coming up, and you would have to dig and explore to find minerals and stuff.Can't wait for some screenies!
function create(mode) t=1/2 timer.start(t) sprites={image.new("\007\000\000\000\007\000\000\000\000\000\000\000\014\000\000\000\016\000\001\000\031\128\031\252\224\131\031\128\031\252\224\131\031\128\031\252\224\131\031\128\031\252\224\131\031\128\031\252\224\131\031\128\031\252\224\131\031\128\031\252\224\131\031\128\031\252\224\131\031\128\031\252\224\131\031\128\031\252\224\131\031\128\031\252\224\131\031\128\031\252\224\131\031\128\031\252\224\131\031\128\031\252\224\131\031\128\031\252\224\131\031\128\031\252\224\131\031\128")} inventory={current=1,{type=0,amount=0},{type=0,amount=0},{type=0,amount=0},{type=0,amount=0},{type=0,amount=0},{type=0,amount=0},{type=0,amount=0},{type=0,amount=0}} i=0 view=0 position={1,1,1} pause=0 w=316 h=210 xlen=math.floor(w/j) ylen=math.floor(h/j) color={} for x=1,xlen do color[x]={} for y=1,xlen do color[x][y]={} for z=1,xlen do color[x][y][z]={visited=false,type=0} if y==xlen then color[x][y][z].type=-1 elseif y<=8 then color[x][y][z].visited=true elseif mode=="clear" then elseif math.random()>0.3 then color[x][y][z].type=1 elseif math.random()>0.3 then color[x][y][z].type=2 end end end end reloadMenu()endfunction reloadMenu() menu={{"Functions",{"Reset",reset},{"Clear",clear}}} toolpalette.register(menu)endfunction clear() create("clear")endfunction reset() create("reset")endfunction on.arrowLeft() c="4"endfunction left() if (position[1]~=1 and view~=1) then position[1]=position[1]-1 elseif (position[2]~=1 and view==1) then position[2]=position[2]-1 endendfunction on.arrowRight() c="6"endfunction right() if (position[1]~=xlen and view~=1) then position[1]=position[1]+1 elseif (position[2]~=xlen and view==1) then position[2]=position[2]+1 endendfunction on.arrowDown() c="2"endfunction down() if (position[3]~=ylen and view~=2) then position[3]=position[3]+1 elseif (position[2]~=ylen and view==2) then position[2]=position[2]+1 endendfunction on.arrowUp() c="8"endfunction up() if (position[3]~=1 and view~=2) then position[3]=position[3]-1 elseif (position[2]~=1 and view==2) then position[2]=position[2]-1 endendfunction on.charIn(ch) c=chendfunction on.timer() platform.window:invalidate()endfunction on.paint(gc) --BG gc:setColorRGB(0,0,64) gc:fillRect(0,0,316,210) if j==nil then j=8 create("clear") end--Keypresses and d-pad if c=="." then if view==2 then view = 0 else view=view+1 end elseif c=="1" then down() left() elseif c=="2" then down() elseif c=="3" then down() right() elseif c=="4" then left() elseif c=="6" then right() elseif c=="7" then up() left() elseif c=="8" then up() elseif c=="9" then up() right() end if c then c="" end --Gravity i=1-i if i==1 and color[position[1]][position[2]+1][position[3]].type==0 then position[2]=position[2]+1 end --Lighting / shroud for x=-1,1 do for y=-1,1 do for z=-1,1 do if not ((x==-1 and position[1]==1) or (y==-1 and position[2]==1) or (z==-1 and position[3]==1) or (x==1 and position[1]==xlen) or (y==1 and position[2]==xlen) or (z==1 and position[3]==xlen)) then color[position[1]+x][position[2]+y][position[3]+z].visited=true end end end end--Inventory/mining if color[position[1]][position[2]][position[3]].type>0 then local slot=-1 for i=1,8 do if inventory[1].type==color[position[1]][position[2]][position[3]].type then end if not inventory[color[position[1]][position[2]][position[3]].type] then inventory[color[position[1]][position[2]][position[3]].type]=1 else inventory[color[position[1]][position[2]][position[3]].type]=inventory[color[position[1]][position[2]][position[3]].type]+1 end color[position[1]][position[2]][position[3]].type=0 end--Draw tilesif view==0 thenfor x=1,xlen dofor z=1,ylen dotop=1for y=position[2]+1,ylen doif top==1 and color[x][y][z] thentop=yendendif x==position[1] and z==position[3] thengc:drawImage(sprites[1],x*j-j*0.5-1,z*j-j*0.5-1)else--Lighting/fogif color[x][top][z].visited==false thend = (math.sqrt((x-position[1])*(x-position[1])+(top-position[2])*(top-position[2])+(z-position[3])*(z-position[3])))d=1-(d/ylen)if d<0 thend=0elseif d>1 thend=1endelsed=1end--Color pickertop=color[x][top][z].typeif top==0 thengc:setColorRGB(255*d,255*d,255*d)elseif top==1 thengc:setColorRGB(150*d,100*d,50*d)elseif top==2 thengc:setColorRGB(150*d,150*d,150*d)elseif top==3 thengc:setColorRGB(200*d,200*d,200*d)endgc:fillRect(x*j-j*0.5-1,z*j-j*0.5-1,j-1,j-1)endendendelseif view==1 thenfor y=1,xlen dofor z=1,ylen dotop=position[1]--for x=position[1]+1,ylen do--if top==1 and color[x][y][z] then--top=x--end--endif y==position[2] and z==position[3] thengc:drawImage(sprites[1],y*j-j*0.5-1,z*j-j*0.5-1)else--Lighting/fogif not color[top][y][z].visited thend = (math.sqrt((top-position[1])*(top-position[1])+(y-position[2])*(y-position[2])+(z-position[3])*(z-position[3])))d=1-(d/ylen*3)if d<0 thend=0elseif d>1 thend=1endelsed=1end--Color pickertop=color[top][y][z].typeif top==0 thengc:setColorRGB(255*d,255*d,255*d)elseif top==1 thengc:setColorRGB(150*d,100*d,50*d)elseif top==2 thengc:setColorRGB(150*d,150*d,150*d)elseif top==3 thengc:setColorRGB(200*d,200*d,200*d)endgc:fillRect(y*j-j*0.5-1,z*j-j*0.5-1,j-1,j-1)endendendelseif view==2 thenfor x=1,xlen dofor y=1,ylen dotop=position[3]--for z=position[1]+1,ylen do--if top==1 and color[x][y][z] then--top=z--end--endif x==position[1] and y==position[2] thengc:drawImage(sprites[1],x*j-j*0.5-1,y*j-j*0.5-1)else--Lighting/fogif color[x][y][top].visited==false thend = (math.sqrt((x-position[1])*(x-position[1])+(y-position[2])*(y-position[2])+(top-position[3])*(top-position[3])))d=1-(d/ylen*3)if d<0 thend=0elseif d>1 thend=1endelsed=1end--Color pickertop=color[x][y][top].typeif top==0 thengc:setColorRGB(255*d,255*d,255*d)elseif top==1 thengc:setColorRGB(150*d,100*d,50*d)elseif top==2 thengc:setColorRGB(150*d,150*d,150*d)elseif top==3 thengc:setColorRGB(200*d,200*d,200*d)endgc:fillRect(x*j-j*0.5-1,y*j-j*0.5-1,j-1,j-1)endendendendendfunction on.mouseDown(x,y)local coords={position[1],position[2],position[3]}if view==0 thencoords[1]=math.ceil(x/j)coords[3]=math.ceil(y/j)elseif view==1 thencoords[2]=math.ceil(x/j)coords[3]=math.ceil(y/j)elseif view==2 thencoords[1]=math.ceil(x/j)coords[2]=math.ceil(y/j)endif color[coords[1]][coords[2]][coords[3]].type==0 thencolor[coords[1]][coords[2]][coords[3]].type=1endend
function color_picker(gc, top) if top==0 then gc:setColorRGB(255*d,255*d,255*d) elseif top==1 then gc:setColorRGB(150*d,100*d,50*d) elseif top==2 then gc:setColorRGB(150*d,150*d,150*d) elseif top==3 then gc:setColorRGB(200*d,200*d,200*d) endend