ID:2208494
 


So, I have created a shitty thing that draws triangles. How does it work?

First you need a special icon. It looks something like this:


It can be 32x32, or it can be larger if you want to reduce the fuzziness of the hypotenuse but if you're good you can hide it.

Now you just create a object or image or whatever, and then set the transform to the output of this proc (set the 3 point coordinates of course):

/proc/transform_triangle(x1, y1, x2, y2, x3, y3, icon_size=32)
var/i = 1/icon_size
var/a = (x3*i)-(x2*i)
var/b = -(x2*i)+(x1*i)
var/c = (x3*0.5)+(x1*0.5)
var/d = (y1*i)-(y2*i)
var/e = -(y2*i)+(y3*i)
var/f = (y1*0.5)+(y3*0.5)
return matrix(a,b,c,e,d,f)


The great thing about this is that you can actually animate it, if you make sure to use ANIMATION_LINEAR_TRANSFORM

What can I do with this then?




(But because changing appearances in byond is slow you can't handle more than a couple players with this)
There are also other fun things you can do with drawing arbitrary triangles:
Curse our lack of client-side leveraging! Otherwise particle effects and lighting would be so much easier to implement.