So far, I have the ray casting ...and it works.
https://gist.github.com/4192017 FYI, wallsGFX[][] contains the wall data. If wallsGFX
- [y] == 0, you can see through it.
rays[][] contains the current ray, and it is re-initialised to 0 at the start of each iteration of the loop.
lineOfSight[][] is where I want to store a '1' for tiles that can be seen, and a '0' for tiles that cannot.
How would you go about transferring this information?
Have I been clear?
I will try to post a little example
wallsGFX[][]
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 1 1 1 1 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
rays[][]
0 0 0 1 0 0 0 0
0 0 0 1 0 0 0 0
0 0 0 1 0 0 0 0
0 0 0 0 1 0 0 0
0 0 0 0 1 0 0 0
0 0 0 0 1 0 0 0
0 0 0 0 0 1 0 0
what lineOfSight[][] should show after this one iteration
0 0 0 1 0 0 0 0
0 0 0 1 0 0 0 0
0 0 0 1 0 0 0 0
0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0