Hello-
Let's say I have a game map and I'm storing player 1's X Y coordinates in a mysql database.
The game map goes from 1-10 in the X and Y direction. You can go off a side of the map, and appear on the opposite side (thus, you go from grid position 10 to 1).
Now, let's say there is a second player who's coordinates are also stored in mysql.
If I want to show player's 2 position on the map if he is within a given range of player 1, how can I go about doing this?
If the range is 4 units in the X or Y planes, and player 1 was at position x=2, y=4 it would need to search for player 2 x within (8,9,10, 1 and 3,4,5,6) and Y within (10, 1, 2, 3 and 5,6,7,8).
How can I accomplish this? Seems like an array would work, but I'm not exactly sure how to implement it.
Any suggestions?
Thanks,
Sledge