Thanks!
After reading how the expression works. I scrambled to do it by long hand..
First
I drew a 10x20 Grid.. I'll just do a 8x8 grid
<--------X--------->
0|1|2|3|4|5|6|7|8|
1|o|o|o|o|o|o|o|o|
2|o|o|o|o|o|o|o|o|
3|o|A|o|o|o|o|o|o|
4|o|o|o|o|o|o|o|o|
5|o|o|o|o|o|B|o|o|
6|o|o|o|o|o|o|o|o|
7|o|o|o|o|o|o|o|o|
8|o|o|o|o|o|o|o|o|
As you can see.. A is located at 2,3 and B is located at 6,5.
so aX is 2 and bX is 6
and aY is 3 and bY is 5
So it would be sqrt((aX-bX)^2 + (aY-bY)^2)
first we figure out what aX-bX is ... (2-6) = -4
2nd we figure out what aY-bY is ... (5-6) = -1
3rd we figure out what -4^2 is .. (-4^2) = 16
4th we figure out what -1^2 is .. (-1^2) = 1
5th we add 16 and 1 which is 17
6th we find the square root of 17 which is 4.123105626
If you try to figure out the distance by counting the squares you'll not be able to get a decimal.. but you can only say that A is 4 squares west from B and 2 squares north from B .. But since it is kinda diagnal you mathematically get 4.1 .. I'm not 100% but I did the math. and I know that this is pretty close..
Thanks! I enjoyed doing the math
I'm still stuck on trying to figure out how to make the enemy turn to face the player.. And I'm only thinking that I must learn math in order to do this.. But would I need to learn trig to do that?