I'm hitting a block with some arrays; I'd like you help :)
I'm making "bouncing" attack system.
function is findtargetbouncing()
my Projective has an area2d that uses getoverlappingbodies when hitting an enemy.
So that I can see if/how many enemies are in range for bounce doing a FOR that breaks once it found a proper target.
Then, I select the closest one, and move toward him. Adding him to the bouncinghistory array.
On hitting the target, the function is called again.
When I'm hitting my "maxbounce" amount, i queue_free() the projectile.
The problem is when there are 2 enemies. and im supposed to bounce 4 times.
After hitting the 2nd enemy, the projectile will wonder chaotically.
So. My (i think) solution, would be to check the array units = getoverlappingbodies
and compare it to the bouncinghistory and that when ALL unit in units are in bouncing_history , I know that my projectile has hit all it could and i can queuefree early.
I just cant figure out a clean way to compare all entries' from an array to an other one.
could anyone illuminate me with this ?