I understand, now, what you're saying.
Code: Select all
dim i as integer
for i = 0 to 9
if i = 0 orelse i = 9 then print "At a limit.": continue for
print "Not at a limit."
i = 0
print "At a limit."
for i = 1 to 8
print "Not at a limit"
i = 9 ' Redundant. For clarity...
print "At a limit"
The problem is that (bx, by) are not tile positions, but probably (speculating) belong to a game object of some kind, the for loop is probably constructed, to loop through every tile, to check if the player (or somethign) is at the border of the tile.
for tx = 0 to tileMaxX-1
for ty = 0 to tileMaxY-1
That's why I think your solution doesn't make sense. Because he iterate the tiles anyways, in order to draw them, and likewise he needs to check each tile...
It seems like the tiles are CONSTS, then they would all be in increments of some known amount, 16x8xwhatever...
So, one check might be able to be performed, to see if
if mod (bx/tileSizeX) = 0
if mod (by/tileSizeY) = 0
if mod (bz/tileSizeZ) = 0
Then, you wouldn't have to perform the check at all in loop...
That sounds right, I think. Maybe that'll work. I'm not sure. I wonder if Gonzo is even still reading this thread.
Anyways, I sort of think I actually might know what you mean. The thing is, I read threads like this very closely, where people start posting alternate solutions, it gets interesting and you can learn a lot. Anyways, I spent at least 10 minutes for the past 3 days struggling to figure out what you meant (probably more, because I was so perplexed), I think we are understanding Gonzo's problem differently:
There's no point in checking if bx equals 0 or if bx equals the max when you know that bx equals 0 at the start and it equals 0 at the end.
I don't think bx is the counter, if it is then you're right, and it makes perfect sense.