It would be like this:
floodfill x,y [c]
and it would work like floodfill tool in MS paint. In case of non-closed area, it'll take screen edge as the border.
This will make easier to make polygon-based 3D engines if one wishes to - currently we sure can but either we have to make up our own floodfill function which takes up tokens or have do with wireframes.
P#13515 2015-09-01 18:47 ( Edited 2018-10-13 15:37)
Floodfill internal to PICO-8 would be nice. There is a good function to do it fairly quickly:
-- pretty darned fast fill ---- function fill(x,y,c,b) if (b==nil) b=pget(x,y) if pget(x,y)==b then pset(x,y,c) if (x>0) fill(x-1,y,c,b) if (x<127) fill(x+1,y,c,b) if (y>0) fill (x,y-1,c,b) if (y<127) fill (x,y+1,c,b) -- can't use for/next as the -- recursion eats all of stack. -- thanks, cheepicus! end end |
P#57910 2018-10-13 11:37 ( Edited 2018-10-13 15:37)
[Please log in to post a comment]