Trouble making a true equation
Posted: Thu May 25, 2006 4:49 pm
Sorry about the vague title...
My program loads a map file and whatnot, let's say one of the points has a tile number of 9. I need to take that number, then, based on the number of tiles horizontal and the number of tiles vertical in the tileset, find the column and row that tile is in, then finally convert those to x and y coordinates.
So... In a step by step form
let's say...
tile number= 9
tiles vertical= 3
tiles horizontal= 6
step 1: see how many times 6 can go into 9, subtract 6 * the amount of times six goes into 9, which is one, we're left with 3. 3 is the column the tile is in.
step 2: the amount of times 6 went into 9 plus one will equal the row the tiles is in.
I may have screwed up typing and totally made my idea total gibberish so point out if I did.
I can think of how to do it in my head but when I try to type down actual equations for it everything gets all frigged up.
I came close today but there's something that mod does that ruins it.
This should be simple math but for some reason I can't think of the equation.
Thanks for any help. It's much appreciated.
Dave.
My program loads a map file and whatnot, let's say one of the points has a tile number of 9. I need to take that number, then, based on the number of tiles horizontal and the number of tiles vertical in the tileset, find the column and row that tile is in, then finally convert those to x and y coordinates.
So... In a step by step form
let's say...
tile number= 9
tiles vertical= 3
tiles horizontal= 6
step 1: see how many times 6 can go into 9, subtract 6 * the amount of times six goes into 9, which is one, we're left with 3. 3 is the column the tile is in.
step 2: the amount of times 6 went into 9 plus one will equal the row the tiles is in.
I may have screwed up typing and totally made my idea total gibberish so point out if I did.
I can think of how to do it in my head but when I try to type down actual equations for it everything gets all frigged up.
I came close today but there's something that mod does that ruins it.
This should be simple math but for some reason I can't think of the equation.
Thanks for any help. It's much appreciated.
Dave.