int GetZone(int x, int y)
Returns the numerical index of a map zone at the given coords, and not the zone's textual name.
Note: Coordinates are in terms of tiles, not pixels. In order to convert tiles to pixels do, (pixel coordinate / 16).
// Imagine the following 7 by 7 grid is your map, // Where the top and left are the X and Y coords. // 0 1 2 3 4 5 6 // // 0 0 1 0 0 0 0 0 // 1 0 2 0 0 0 0 0 // 2 0 0 0 0 0 0 0 // 3 0 0 9 0 0 4 0 // 4 0 0 0 0 0 0 0 // 5 0 2 1 0 0 0 0 // 6 0 0 0 0 0 0 0 GetZone(0, 0); // Returns 0. GetZone(1, 0); // Returns 1. GetZone(1, 1); // Returns 2. GetZone(3, 5); // Returns 4. GetZone(4, 5); // Returns 0. GetZone(3, 2); // Returns 9. GetZone(5, 2); // Returns 1. GetZone(6, 6); // Returns 0.
There are no talkbacks on this documentation page yet. Post the first?
Doc Nav |
Your docs |