Fun little renders. :)
Play project
Pico 1k Terrain Generator's itch.io pageCompressed Bytes used
763
Source Code (OPTIONAL)
//the owtg
//by atacogals
function _init()
fg={} mg={} bg={} s1={}
s2={} s3={} s4={}
c3=4c2=9c1=10sel=0
end
function _update()
if btnp(4) then
lp(75,c3,1)lp(95,c2,2)
lp(115,c1,3)sp(5,1)
sp(13,2)sp(6,3)sp(7,4)
end
if btnp(2)then sel+=1end
if btnp(3)then sel-=1end
if sel>3then sel-=1 end
if sel<1then sel+=1 end
if btnp(0)then
if sel==1then c1-=1elseif sel==2then c2-=1else c3-=1end
end
if btnp(1)then
if sel==1then c1+=1elseif sel==2then c2+=1else c3+=1end
end
for b in all(bg)do b:up()end
for m in all(mg)do m:up()end
for f in all(fg)do f:up()end
end
function _draw()
cls(0)print("z to generate",2,2,6)print("arrows for color",64,2)
print("l:"..sel,116,8)
for s in all(s1)do s:dr()end
for s in all(s2)do s:dr()end
for s in all(s3)do s:dr()end
for s in all(s4)do s:dr()end
for b in all(bg)do b:dr()end
for m in all(mg)do m:dr()end
for f in all(fg)do f:dr()end
end
function lp(yb,cl,l)
local lx=0local ly=rnd(10)-5
if l==3then d=fg elseif l==2then d=mg else d=bg end
for i=1,128 do for i1=1,50 do
if l==3 then del(fg,fg[i1])elseif l==2 then del(mg,mg[i1])else del(bg,bg[i1])end
end end
for i=0,127 do
add(d,{x = lx, y = ly+yb,clr=cl,
dr = function(self)line(self.x,127,self.x,self.y,self.clr)end,
up = function(self)if sel==3 and l==1 then self.clr=c3 elseif sel==2 and l==2 then self.clr=c2 elseif sel==1 and l==3 then self.clr=c1 end end})
lx+=1if ly>0then ly+=rnd(5)-4elseif ly<-20then ly+=rnd(5)+2else ly+=rnd(6)-3end
end
end
function sp(cl,l)
if l==4then d=s4 elseif l==3then d=s3 elseif l==2then d=s2 else d=s1 end
for i=1,15 do for i1=1,50 do
if l==4then del(s4,s4[i1])elseif l==3then del(s3,s3[i1])elseif l==2then del(s2,s2[i1])else del(s1,s1[i1])end
end end
for i=1,15 do
add(d,{x=rnd(120)+4,y=rnd(64)+10,
dr = function(self)pset(self.x,self.y,cl)end})
end
end
Leave a comment
Log in with itch.io to leave a comment.