Shifting elements in array to the right?
in
Programming Questions
•
10 months ago
Hello all,
I've run into a problem and can't think of a creative way around it. I am trying to shift the elements of a 2D array right or left depending on where a user places their cursor. I'm doing this to create the "illusion" of scrolling left and right (respectively). I've handled the shifting of elements to the left rather easily using a for loop, but I'm having trouble shifting to the right.
It's a rather complicated problem to explain, but it has to do with the fact that I currently
have to iterate forward through the array at all times, making shifting to the right difficult (since you usually just reverse the iteration direction). I've attached a link to download the code portion I'm talking about, just because it would take a rather verbose post to explain all the exceptions and reasoning behind the structure of the code.
The code in question is in the "scroll" tab and the method is called in the "draw" tab.
Any ideas on how to get this to work would be greatly appreciated. I've been at this for several hours and need a fresh perspective.
Thanks!
1