I made a function to draw an equilateral triangle that I could animate:
function triangle(_x,_y,_size,_angle,_clr) for i=0,2 do local _offset=.33*i local _x1=_x+(cos(_angle+_offset)*_size) local _y1=_y+(sin(_angle+_offset)*_size) line(_x1,_y1,_clr+i) end end |
Pico 8 does something weird when I try to draw 2 triangles made out of lines:
I can draw each triangle just fine, but when I put the triangle() function twice it weirdly connects the triangles.
I have no idea why it does that, I could use some help.
here's the full code
function _init() end function _update() end function _draw() cls() triangle(64,64,30,0.255,8) triangle(64,64,30,0.255+0.5,12) end function triangle(_x,_y,_size,_angle,_clr) for i=0,2 do local _offset=.33*i local _x1=_x+(cos(_angle+_offset)*_size) local _y1=_y+(sin(_angle+_offset)*_size) line(_x1,_y1,_clr+i) end end |
line()
with 2 or 3 arguments uses the end of the last line op as the starting point. You probably want to explicitly specify your start and end by calling line()
with 4 or 5 args.
[Please log in to post a comment]