why does step have to be constant?

BlitzMax Forums/BlitzMax Beginners Area/why does step have to be constant?

slenkar(Posted 2008) [#1]
Im writing some code to put images together into a tile map using the step command:

for x= map_start to map_end step tile_width

but I cant do it because step has to be constant


markcw(Posted 2008) [#2]
Why do you always post in the wrong forum?


H&K(Posted 2008) [#3]
Mark posted a spesific reply to this ages ago, cos lots of ppl where asking. And it went on the lines of

"Cos its loads faster for Bamx to do it this way"

Also, cos most of us where used to pre step any way we would

for x= map_start to int (map_end/tile_width)
temp tx= x*tile_width (changing slightly depending on what values map-start might be)

Im sure Mark mentioned changing step so that it could be a variable as long as it was constant for the fors life, as in your example. But as with lots of things of this ilk, the work round is so easy he probably just didnt bother


Brucey(Posted 2008) [#4]
Right, as H&K points out, it's not difficult to come up with a different way of doing it...
x = map_start

while x <= map_end

    ...

   x:+ tile_width

wend



slenkar(Posted 2008) [#5]
yeah I was tired yesterday I usually deal with it the way brucey said thanks