2D Array System Around a Player

Hi all,

I’ve never posted on here before, so please bear with me. I’m not entirely sure how well I can explain my problem, but I’ll try and hopefully can get something that makes sense to people.

I have an actor that follows the player around with holds a 2d array of cubes, each of these cubes holds some detail about the area it resides in. Due to the world size I can’t have a cube for every spot of the map so it’s a limited size (I’ll do a mock up below).

So the cubes will sit like this below (in reality I currently have it at 16x16, but 5x5 will be fine for my explaination). (The P is the player)

] ] ] ] ]
] ] ] ] ]
] ][P] ] ]
] ] ] ] ]
] ] ] ] ]

When the player moves to the left by the size of a full cube it would sit like this:
] ] ] ] ]
] ] ] ] ]
][P] ] ] ]
] ] ] ] ]
] ] ] ] ]

But I have the system follow the player - which is great! However all of the data in the cubes also follows the player at this point and that’s what I’m looking to change.

So if I have this set up:
] ] ] ] ]
] ] ] *] ]
] ][P] ] ]
] ] ] ] ]
] ] ] ] ]

And then I move to the left and it adjusts I will get this still:
] ] ] ] ]
] ] ] *] ]
] ][P] ] ]
] ] ] ] ]
] ] ] ] ]

Whereas what I actually want to occur is:
] ] ] ] ]
] ] ] ] *]
] ][P] ] ]
] ] ] ] ]
] ] ] ] ]

I thought about moving the rows/columns of the array based on the movement - but if I do that it then jumbles up the array significantly and I can’t get my head around the process of re-sorting it all. I’m struggling to find anything out there on this too - as I don’t really know the terminology besides it being a 2d array.

Hopefully the diagrams explain it better than words could - any input/direction is greatly appreciated and apologies if it’s really obvious!

Cheers.

No worries all - I appear to have come up with a solution! I think I had been overthinking the problem.