I’m having a tough time trying to figure this out.
I am trying to add my enemy actors to an array based on distance from the player. So the closest would be at index 0 and the next closest would be at 1 and so on.
Can someone show or explain to me how to do this? I am sure it’s something simple that I’m just not getting at the moment!
Hello,
As Yun-Kun said frequency of check can be a trouble. Idea i would follow is first “get all actors” and use this array to set an array of integers with a check length between enemy and player. If array element is > than current length then set array integer same as checked one and add one to checked integer and all the ones after. When done get first array to set a new array with “set element” using array of integers as index. There are few tricks needed i suppose, like initial variable needed to be high and a bool to check if array as been set or if this is last element on completed (then it needs to be added)