Take the 2-minute tour ×
Role-playing Games Stack Exchange is a question and answer site for gamemasters and players of tabletop, paper-and-pencil role-playing games. It's 100% free, no registration required.

I am working on implementing the SRD in Python (programming language), but unfortunately I am not great at math. I am stumped with figuring out how to calculate all of the squares that are within range of a radius (or cone) attack.

I did find What is a radius on a square grid?, which gives a handy formula for calculating the distance between squares (if a given square is within range). D=√((X * X)+(Y * Y))

I am hoping there are some math whizzes on here that can help me come up with a formula!

grid details:

I am using a simple coordinate system, (x,y) starting with 0 as first row on top and 0 as first column on the left.

share|improve this question

closed as off-topic by Phil, SevenSidedDie, Tridus, LitheOhm, okeefe Nov 25 '13 at 20:16

  • This question does not appear to be about role-playing games within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

1  
I think this is off topic I'm afraid. You're better off asking on math.stackexchange.com. –  Phil Nov 25 '13 at 18:49
3  
This question appears to be off-topic because it is about maths –  Phil Nov 25 '13 at 18:50
2  
@James Lee Vann, how does this question differ from the one you already linked? How do you expect your answers to be different? –  Colin D Nov 25 '13 at 19:03
2  
Rasterising a circle is a basic programming question. Try GameDev.SE or StackOverflow. Actually nevermind, here's the Wikipedia article on how it's done: en.wikipedia.org/wiki/Midpoint_circle_algorithm –  SevenSidedDie Nov 25 '13 at 19:22
2  
possible duplicate of What is a radius on a square grid? –  okeefe Nov 25 '13 at 20:16

Browse other questions tagged or ask your own question.