Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / Need some help with map grid coordinates...

Author
Message
Chessplayer
21
Years of Service
User Offline
Joined: 22nd Dec 2002
Location:
Posted: 16th Oct 2003 04:26
How do 2D map coordinates work? I'm having some trouble understanding them. How do you calculate columns and rows in a grid? I looked at the Underware design's 2D tile map collision, but that was a little to complex.

This is still Chessplaer! I just decided to spell my handle correctly!
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 17th Oct 2003 01:30
Assume you have a 10x10 grid. Each tile is 100x100 units. So every column is 100 units. 10 columns at 100 units each gives us 1000 total units for the whole map. So column 1 is units 1-100. Column 2 is units 101-200, then 201-300, etc. So, you could take your world coordinate, say its 452, and divide it by the tile size, in this case it's 100. so 452/100 = 4 (only need integer part). Now if your columns start at 0 for the first one, 452 lies within column 4. Otherwise, if the column numbers start at 1, just add 1 to your answer and you'll get 5 for the column number. Same thing for rows. Understand?
Chessplayer
21
Years of Service
User Offline
Joined: 22nd Dec 2002
Location:
Posted: 18th Oct 2003 03:20
Thanks for the help! I'm glad that I finally understand this now. I really appreciate it!

This is still Chessplaer! I just decided to spell my handle correctly!

Login to post a reply

Server time is: 2024-04-27 22:15:39
Your offset time is: 2024-04-27 22:15:39