moving 1 to another position if keyhit is true?

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

All you need are two variables to keep track of where the box is : X and Y.

If you move left, reduce X.
If you move right, increase X.
If you move up, reduce Y.
If you move down, increase Y.

Initially, the box will be in an arbitrary position in the array, say [5,5]. So X will store 5, Y will store 5 and the array at index [5,5] will be set to 1 at the start. When you make a move, you set the array at index [X,Y] to 0, you make the move, then set the array at the new index to 1.

However, you will also need to check that a move will not take you outside of the array, and you will also need to include some sort of delay into your movement routine otherwise the movement will be too fast to see.

Come on Amon, you should be able to do this sort of stuff!

Ryan