XYth tile to Tile #Z
Ok, don''t know exactly how to say this, but say I have a bitmap with all my tiles drawn on it. The bitmap is a 3x3 map. Ok, tile (2, 1) would be tile #4 if I were to count from left to right, I know that, and you know that. So how do I go about telling the computer this. I figured out a small mathematical formuala for it, but it does not seem feasible. BTW, I dont want to load all the tiles into their own surfaces either, or is that the best way to go about it?
- I don't pretend to know anything.Snowsoft
I messed up on this post, what I mean is exactly the opposite. How do I convert #Z to XYth tile.
- I don't pretend to know anything.Snowsoft
MAXCOL 3MAXROW 3getXY(in cellnum, out X, out Y)tempnum = cellnumy=1;x=1;While (tempnum > MAXCOL){ tempnum -= MAXCOL y++}x=tempnum
Edited by - Gorg on July 30, 2000 7:32:06 PM
July 30, 2000 05:25 PM
Try something similar to this:
x = cell_number % MAX_COLUMNS
y = cell_number / MAX_COLUMNS
(''%'' is the modulo (eng.?) operator)
x = cell_number % MAX_COLUMNS
y = cell_number / MAX_COLUMNS
(''%'' is the modulo (eng.?) operator)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement