Archived

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

question (coordinate of map etc)

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

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 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 on other sites
can u pls explain more elaborately . thanx alot.my whole map is shaped like a diamond.

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 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 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.

1. 1
2. 2
Rutin
26
3. 3
4. 4
JoeJ
18
5. 5
gaxio
11

• 14
• 22
• 11
• 11
• 9
• Forum Statistics

• Total Topics
631763
• Total Posts
3002197
×