Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Nauxel

1
Posts
1
Topics
3
Followers
166
Following
A member registered Jan 14, 2017

Recent community posts

Are you tired of boring, plain old 'tri'? Do you want to use an easier way to draw a triangle? Worry not! Introducing 'triab'! Just put x coord there and y coord here, rotate the rotation, sprinkle the size, colorise the color and put some border on or off depend on ur taste. And BAM! you got urself a triangle. Only $5.99! 

Jokes aside, I wrote a small code and I decided to share it for you guys! Ik some people have their own or even a better way to do it, but I just hope this is useful :D

-----Code-----

function triab(x,y,r,s,c,b)
 local p1,p2,p3=150,270,30
 local x1=(math.cos(math.rad(r+p1))*s)+x
 local y1=(math.sin(math.rad(r+p1))*s)+y
 local x2=(math.cos(math.rad(r+p2))*s)+x
 local y2=(math.sin(math.rad(r+p2))*s)+y
 local x3=(math.cos(math.rad(r+p3))*s)+x
 local y3=(math.sin(math.rad(r+p3))*s)+y
 if not b then
  tri(x1,y1,x2,y2,x3,y3,c)
 else
  line(x1,y1,x2,y2,c)
  line(x2,y2,x3,y3,c)
  line(x3,y3,x1,y1,c)
 end
end

----------Explanation-----------

'x' & 'y' is the coordinate variable

'r' is the rotation angle variable, 90° by default

's' is the size variable

'c' is the color variable

'b' is the border boolean, border is off by default (false). if you want to have the border, just type 'true' 

local p1,p2,p3 is the points which is use to calculate each corner

Dw about the rest, just think it as 'magic'