| tianajrp (23) | |||
|
Imagine you have a 2d plane in C++, where the X go from 0 to MaxX (there is no negative X) and a Y go from 0 to MaxY (go down, not up like normal irl geometry, and no NegativeY) so you would have something like this: For example MaxX = 6, MaxY = 4 http://www.freemmorpgmaker.com/files/imagehost/pics/78226d4275abffdb50d9094b109df5e4.png ^illustration So as you can see there is a total of MaxX * MaxY square, which is 24 (0 to 23) Assuming each square is 32x32 How would u write a function that give the coordinate of each square given their ID (number between 0 - 23)? write it dynamically I tried but it didnt work this is what i got:
| |||
|
|
|||
| cire (2347) | |||
Using TILE_WIDTH and TILE_HEIGHT in place of the magic number 32 in the last two lines would be better but, given your attempt, I'm not certain exactly what they're supposed to represent. | |||
|
|
|||