# 2D Array System Around a Player

**URL:** <https://forums.unrealengine.com/t/2d-array-system-around-a-player/123390>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [March 10, 2019, 8:35pm UTC](https://forums.unrealengine.com/t/2d-array-system-around-a-player/123390 "2019-03-10T20:35:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Boruki](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Boruki](https://forums.unrealengine.com/u/Boruki)\
**Post date:** [March 10, 2019, 8:35pm UTC](https://forums.unrealengine.com/t/2d-array-system-around-a-player/123390/1 "2019-03-10T20:35:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Boruki](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Boruki](https://forums.unrealengine.com/u/Boruki)\
**Post date:** [March 12, 2019, 3:32pm UTC](https://forums.unrealengine.com/t/2d-array-system-around-a-player/123390/2 "2019-03-12T15:32:28Z")

</div>

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