moving 1 to another position if keyhit is true?

BlitzMax Forums/BlitzMax Beginners Area/moving 1 to another position if keyhit is true?

Use a counter variable, say "BoxPos", to keep track of where the box currently is. Initially, BoxPos = 0.

The algorithm you need would be something like this:

(This assumes the array is a 'square', with size ArraySize)

If Keyhit(theKey)

   array[BoxPos / ArraySize, BoxPos Mod ArraySize] = 0
   BoxPos = BoxPos + 1
   array[BoxPos / ArraySize, BoxPos Mod ArraySize] = 1

Endif

Ryan