Skip to content

Instantly share code, notes, and snippets.

@Godzil
Created October 18, 2018 11:03
Show Gist options
  • Save Godzil/454f5bfa9336e15692b4bac70d112be3 to your computer and use it in GitHub Desktop.
Save Godzil/454f5bfa9336e15692b4bac70d112be3 to your computer and use it in GitHub Desktop.
# Translated from PICO-8 Lua code to Python/Pyco8
# Original: https://twitter.com/lexaloffle/status/1052826402322403328
"""
function b(u,v,a,l)
if(l<3)circfill(u,v,1,13+q%3)return
local x,y=u+cos(a)*l,v+sin(a)*l
line(u,v,x,y,13+q%3)q+=1
for i=0,1,0.34 do b(x,y,a+i+0.25+t()/16,l*0.6)end end
::🐱::q=0 cls()for i=0,1,.34 do
b(64,64,i+t()/8,30,7)end
flip()goto 🐱
"""
from pyco8 import pyco8
pico = pyco8()
def b(u, v, a, l):
global q
if l < 3:
pico.circfill(u, v, 1, 13 + q % 3)
return
x, y = u + pico.cos(a) * l, v + pico.sin(a) * l
pico.line(u, v, x, y, 13 + q % 3)
q += 1
for i in pico.drange(0, 1, 0.34):
b(x, y, a+i+0.25+pico.t()/16., l*0.6)
while True:
q = 0
pico.cls()
for i in pico.drange(0, 1, .34):
b(64, 64, i + pico.t() / 8, 30)
pico.flip()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment