Log In  

Cart #dewimerojo-0 | 2023-08-21 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1


Cart #dewimerojo-1 | 2023-08-21 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

P#133346 2023-08-21 08:04

Nice!

It might be nice to redraw the tree when Z is pressed instead of reloading the whole cartridge. Something like this, maybe?

function _update()
 if btnp(4) then _init() end
end

It can be fun to have more branches, which can be done by having a function which calls itself:

function draw_branch(
  x1,y1,depth,branches)
 if depth==0 then
  return
 end

 for branches=0,branches do
  local x2,y2=draw_line(x1,y1)
  draw_branch(x2,y2,
    depth-1,branches+1)
 end
end

function _init()
 cls()
 draw_branch(64,128,5,0)
end
P#133403 2023-08-22 17:01

[Please log in to post a comment]