04-10-2011, 05:31 AM
[/lua]
What you do is you choose the X that the lightning will strike at, then you choose how many points there are, then you keep making points at X + randomnumberhere so that way it's random, then you make a function for making parts that are a line from one place to another (this might work)
[lua]function line(from,to,thickness)
local p=create("Box")
p.Position=from:add(to):divide(2)
p.Size=Vec2D((from.x^2+from.y^2)^0.5,thickness)
p.Rotation=math.atan2(from.y-to.y,from.x-to.x)
return p [/lua]
I think the atan2 is screwed up but oh well
(04-10-2011, 05:15 AM)Scripter Wrote:(04-10-2011, 05:14 AM)toast Wrote: Nu you have to make lightning out of yellow Boxes so it's randomer and more realistic
xD
But, if you're going to have a lot of lightning strikes...THAT WILL BE A LOT OF MATH THAT I DON'T KNOW HOW TO DO.
What you do is you choose the X that the lightning will strike at, then you choose how many points there are, then you keep making points at X + randomnumberhere so that way it's random, then you make a function for making parts that are a line from one place to another (this might work)
[lua]function line(from,to,thickness)
local p=create("Box")
p.Position=from:add(to):divide(2)
p.Size=Vec2D((from.x^2+from.y^2)^0.5,thickness)
p.Rotation=math.atan2(from.y-to.y,from.x-to.x)
return p [/lua]
I think the atan2 is screwed up but oh well
Siggy by McNoobster!