Created
September 7, 2020 16:37
-
-
Save LeMasters/41b2f8d6f3cb9018d6229918bc0e004b to your computer and use it in GitHub Desktop.
genart one
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--pico8 genart one | |
-- sept2020 | |
function _init() | |
cls(1) | |
counter=0 | |
updatescreen=true | |
layers=3 | |
colqty = 6 | |
rowqty = 6 | |
colwidth = 128/colqty | |
rowheight = 128/rowqty | |
end | |
function _update() | |
counter=counter+1 | |
if (counter%100==0) then | |
updatescreen=true | |
else | |
updatescreen=false | |
end | |
end | |
function _draw() | |
if (updatescreen==true) then | |
cls(1) | |
radius = flr(colwidth/2) | |
for pass=layers,1,-1 do | |
scale=pass/layers | |
for col=0,colqty-1 do | |
for row=0,rowqty-1 do | |
x1=col * colwidth | |
x2=x1+colwidth-1 | |
xcenter=(x1+x2)/2 | |
y1=row * rowheight | |
y2=y1+rowheight-1 | |
ycenter = (y1+y2)/2 | |
mycolor=rnd(1)*15+1 | |
mycolor=flr(mycolor) | |
mycolor=mycolor%6+1 | |
-- pick a shape | |
shape=rnd(1) | |
if (shape>0.49) then | |
xdist=(colwidth)/2 | |
ydist=(rowheight)/2 | |
xdist=xdist-1 | |
ydist=ydist-1 | |
xdist=xdist*scale | |
ydist=ydist*scale | |
x1=xcenter-xdist | |
x2=xcenter+xdist | |
y1=ycenter-ydist | |
y2=ycenter+ydist | |
rectfill(x1, y1, | |
x2, y2, mycolor) | |
else | |
circfill(xcenter, | |
ycenter, radius * scale, | |
mycolor) | |
end | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment