Archived

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

question (coordinate of map etc)

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi pplez, have questions here hope sumone can help mi. i basically understands how to draw isometric map onto the screen, but then..i was tinkin..lets say i have a very large map [1000x1000tiles x 32x16pixel] ..and my mouse points to screenpixel (200 , 200) on a 800 x 600 screen, how do i determine whats the xy map coordinate of the whole map am i pointing at ? can someone pls give me some advice ? i've read sum articles but i dun realli understand. thanx alot Edited by - ReDair on June 5, 2001 11:17:34 PM

Share this post


Link to post
Share on other sites
What you have to do is add the top left hand co-ordinate of the map onto your mouse co-ordinates. Its that simple. It should go
something like this.

x = mousex + mapx;
y = mousey + mapy;

Share this post


Link to post
Share on other sites
quote:
Original post by ReDair

can u pls explain more elaborately . thanx alot.my whole map is shaped like a diamond.


my whole map is shaped like a diamond. can i draw the map diagonaly down as folowing the map coordinate or will it be better to do it left to right ? any advice ?
thanx

Share this post


Link to post
Share on other sites
You have to have some kind of viewport x/y positions for map viewport. Like, ur map starts at 0,0 and your viewport is size 800x600 right?
So, your mouse coord in tiles will be:
xtile=(getmousex+viewportx)/sizeoftilex;
ytile=(getmousey+viewporty)/sizeoftiley;

So, u can get ur tile if ur map is like map[1000][1000], so to access tile ove which ur mouse is over is map[xtile][ytile]

Share this post


Link to post
Share on other sites
Tans has a really good article in the GameDev forums about mapping the mouse coordinates to a map coordinate. I highly recommend reading that article.





Dino M. Gambone
Good judgement is gained through experience. Experience, however, is gained through bad judgement.



Share this post


Link to post
Share on other sites