Hey, sorry if I'm in the wrong forum, but I need some help with getting the left and top values for a tile from a tile set. A book I have gives these two formulae:
left = (current frame % number of columns) * sprite width
top = (current frame / number of columns) * sprite height
Now, I'm no expert, but these seem completely wrong.
For the left value, I came up with:
left = ((current frame-1) % number of columns) * width
This seems to work based on my testing
For top, I came up with:
top=((current frame/cols) - 1) * height
but after testing found that it only works for tiles on the right side of the set.
Does anyone know a formula I can use for the top value/check if the one I have for left value make sense/check if the original two in my book were fine and I'm just crazy. Thanks. :)