Topic: Array changing values by itself!

Hi, I'm brand new so I hope this is the right section!

I've looked through my code and through extensive testing have located the section where the problem is occurring. Somehow, the array called 'gamemap' is changing every time I press the update the screen, despite having no code that changes it at all. After testing different areas to see at what point the array is changing, I have located it to here.


def updateScroll():
    global grid, gamemap
    for i in range(rows):    
        for row in range(rows):
            grid[i][row] = gamemap[mapx+i][row]   

Ok basically what I'm working with here is side scrolling game. I have a 20x20 display grid, and gamemap, which stores the entire map and procedurally generates more map, with is however long the map is x 20

mapx refers to the current position at the far left side of the display grid. It increases/decreases by one at every time you need to scroll left or right, currently controlled by the keyboard for testing. updateScroll goes through and takes a column of data from the gamemap at the position mapx and sticks it at the first column of the display grid, then takes the column from gamemap at position mapx+1 and puts it at the second column of the display grid and so on.

Any help gratefully received! Thanks for your time!

Thumbs up