I don't really understand you example ritchie.
But I really wonder why my way doesn't work.
-First I make a copy of the original array:
-Then I pick values from the temp array to the original array. If i want a column to move one step up I do this:
That code is assigning the values of tempArray[i+1]["THE ACTIVE COLUMN"] to array[i]["THE ACTIVE COLUMN"]. That should move all elements in the column (except the one on the top) one step up and i think it works too. But the problem seems to be on the line
which is excecuted when (i+1 < rows) is not true which means it excecutes when the it's the last iteration of the loop. This line is supposed to take the element on the top of the column and place it on the bottom. It takes the value tempArray["THE ACTIVE COLUMN"] (which is the element on the top of the column from the original order) and places it in array[rows-1]["THE ACTIVE COLUMN"] (which is according to my logic the last element in the column in the array with the new order). What i think this line does in reality is that it takes the value from the top of the column in the new order and places it in the last element in the column. But I don't get why it does that.
For me it would be entirely logical for this to work but it doesn't. Could someone explain why?
I hope you understand what I've written since english ain't my native language.
I'll still try to explain for what i need this.
I want to animate an image(a 16x16 tile for my game) of a waterfall. First I load the image to the program. Then I read it's pixeldata and place it in a 1D array. That 1D array I then convert to a 3D array which contains the alpha, red, green, blue values for each pixel. When the image is in this form I want to move the pixels from ONE column one pixel down. Then I change it back to 1D array and to a picture. I repeat this with other columns and it looks like water is falling. I want to have a method which can move the rows or columns in any direction (up, down, left, right) so I can animate other things too. If there's a faster way to move the pixels please let me know.
[ June 18, 2006: Message edited by: Jon Mattson ]