Hello all I’ve been trying to create a lightning effect using the blender’s game engine.

So far, the approach I’ve been using is the render.drawLine() function. Basically I have two empties, one named “Start”, the other named “Finish”, and I’m using the drawLine() function to draw a line between these two points. What I want to do is get all the incremented points between “Start” and “Finish”, and then have them move perpendicular from the line at random points above and below it.

How do I do this?

Here’s what I have so far:

```
import bge
import random
from bge import logic
from bge import render
cont = logic.getCurrentController()
obj = cont.owner
start = logic.getCurrentScene().objects["Start"]
finish = logic.getCurrentScene().objects["Finish"]
dy = start.position.y - finish.position.y
dx = start.position.x - finish.position.x
slope = dy/dx
intercept = start.position.y-(slope*start.position.x)
def drawArc():
render.drawLine( start.position, finish.position, [50, 0, 50])
logic.getCurrentScene().post_draw = [drawArc]
```

You’ll notice I already wrote the code to find the slope and the intercept of the line. So how do I write a function the starts a bunch of incremented points between “Start” and “Finish”, and then drawLine() between each point, and have the points move up and down randomly( each differently random from other points) perpendicular to the line between “Start” and “Finish”? This will hopefully give the effect of lightning.

Please help! And thank you!