#### Archived

This topic is now archived and is closed to further replies.

# Storing isometric coordinates

This topic is 5858 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi guys! i want to know if storing the coordinates in the map matrix is a good idea. (my english sux i ´ll give u an example) e.g: matrix [1][1].tile=1; matrix [1][1].coordx=2; matrix [1][1].coordy=3; .... an then i do a for that goes throught each array end shows it ... does it is a good idea? SOrry about my english.... __________________ ::Homer Simpson::

##### Share on other sites
there''s no need to do that.
you should have a function, that converts map coordinates (ie. index x,y of a matrix) into screen or world coordinates.
for example, in a diamond map, this function would be something like:
//POINT is a structure that has .x and .yPOINT MapToWorld(POINT ptMap){   POINT ptWorld;   ptWorld.x = (ptMap.x-ptMap.y)*TILEWIDTH/2;   ptWorld.y = (ptMap.x+ptMap.y)*TILEHEIGHT/2;   return (ptWorld);}

you can tell the function (or make more versions of it) if you''re using a different map type.
that way you don''t have to give the tiles numbers, either. just run through the matrix x and y.

//Demiurge
Make something idiot proof, and someone will make a better idiot..

##### Share on other sites
thnx guy, but even if I do this function,i will have to stare the "results" in a matrix, wont i???

• 11
• 20
• 12
• 10
• 34
• ### Forum Statistics

• Total Topics
631399
• Total Posts
2999854
×

## Important Information

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!