Log In  


Cart #sesatereke-0 | 2021-10-13 | Code ▽ | Embed ▽ | No License
1

Someone on Twitter asked for this, and this seemed like the easiest place to share the code.

function preplace_in_circle(centerx,centery,radius,checkcol,newcol)
	local topleft={x=centerx-radius,y=centery-radius}
	local bottomright={x=centerx+radius,y=centery+radius}
	for x=topleft["x"],bottomright["x"] do
		for y=topleft["y"],bottomright["y"] do
			if (x-centerx)^2+(y-centery)^2<radius^2 then
				if (pget(x,y)==checkcol) pset(x,y,newcol)
end
end
end
end
function psetin_circle(centerx,centery,radius,checkcol,col)
	local topleft={x=centerx-radius,y=centery-radius}
	local bottomright={x=centerx+radius,y=centery+radius}
	for x=topleft["x"],bottomright["x"] do
		for y=topleft["y"],bottomright["y"] do
			if (x-centerx)^2+(y-centery)^2<radius^2 then
				 pset(x,y,col)
			end
		end
	end
end
1


as you may have noticed, pico cannot maintain 30fps using fullscreen pset operations.
such effect should be done using copy to memory/spritesheet and then masking with a sprite (or tline).



[Please log in to post a comment]