Log In  


Cart #ghoulsatemyclassmates-0 | 2020-07-06 | Code ▽ | Embed ▽ | No License
2

Hello!
just started with pico8, and played around with it.. this is (at the moment) just something to get used to the API. There's a function in there, that might be interesting for some of you, though. It prints a string with different colors per scanline.

function _draw()
 cls()
 cprint("colored text",nil,20, {7,11,3})
 cprint("pass nil for x to center",nil,30, {12,6,13})

 cprint("press ❎ to start",nil,80,{9,10,9})
end

function cprint(txt,x,y,cols)
 local len,org=#txt*4+4,clip() 
 local a
 x=x and x or 64-len/2
 for a=1,3 do
  print(txt,x,y,cols[a])	
  clip(x,y+a*2,len,2)
 end
 clip(org)
end
2



[Please log in to post a comment]