Log In  


Flyover voxel rendered terrain-like plasma.

(300 chars)

for y=0,127 do for x=0,127 do sset(x,y,(sin(x/32)/2+sin(y/32)/2+sin((x+y)/64)/2+sin(sqrt(x*x+y*y)/32)/2+sin(x/16*1.2)/4+sin(y/16*1.2)/4+sin((x+y)/32*1.2)/4+2.75)*2)end end function _draw()cls(12)for z=64,1,-1 do for x=0,127 do h=sget(64-z+z*x/64,-(z+t()*32)%128)line(x,h*4/z*32+32,x,128,h)end end end
8


1

Your code was fun to play around with, wanted to add some terrain-y colors.

pos={
x=1,
y=0,
}
speed=.02

terrain_colors=
{
7,6,13,5,3,1,1,1,1,1,
}

for y=0,127 do 
	for x=0,127 do 
		sset(x,y,(sin(x/32)/2+sin(y/32)/2+sin((x+y)/64)/2+sin(sqrt(x*x+y*y)/32)/2+sin(x/16*1.2)/4+sin(y/16*1.2)/4+sin((x+y)/32*1.2)/4+2.75)*2)
	end 
end 

function _update()
	if btn(⬆️) then
		pos.x+=speed
	elseif btn(⬇️) then
		pos.x-=speed
	end
	if btn(➡️) then
		pos.y+=1
	elseif btn(⬅️) then
		pos.y-=1
	end
end

function _draw()
cls(12)
offset=-24
	for z=64,1,-1 do 
		for x=0,127 do 
			h=sget(pos.y+64-z+z*x/64,-(z+pos.x*32)%128)
			line(x,offset+h*8/z*32+32,x,128,terrain_colors[h+1])
		end 
	end
end

> some terrain-y colors
That's what I originally intended to do, but 300 characters ran out faster than I expected 🙂
So, I decided not to sacrifice the complexity of plasma noise.



[Please log in to post a comment]