A relatively simple grid question
Posted on 2000-03-01
Ok, I assume this will be simple to answer, but I forgot most of my algebra equations and don't have a reference. In a game I'm making is a battle-mode which takes place on a grid.
Here's a legend of a sample battlefield layout(in text of course)
A - archer
1 - random enemy #1
2 - random enemy #2
T - target
[ ] - empty space
[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] coords:
[ ] A [ ][ ][ ][ ] 2 [ ][ ][ ] A: 1, 1 2: 6, 1
[ ][ ][ ][ ][ ][ ] 1 T [ ][ ] 1: 6, 2 T: 7, 2
I want to fire an arrow at the target, but there are two other enemies in the way. Which one is hit? I need some sort of algorythm to figure out which square is in the path's way.
The calculation obviously won't be as precise as deciding if a bullet passed between the enemy's legs as it would in MDK(FPS game), but I need something that can figure trajectory on a simplified scale.
I appologize to the impatient who understood the question within a few sentances, I just didn't want to explain myself a hundred times. Thanks.
Also, if someone would like to add an algorythm or bit of code to show the arrow's range radius in grid format, I'd appreciate it.