![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | quizzcode |
Hello there,
I’m hitting a block with some arrays; I’d like you help
I’m making “bouncing” attack system.
function is find_target_bouncing()
my Projective has an area2d that uses get_overlapping_bodies 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 bouncing_history array.
On hitting the target, the function is called again.
When I’m hitting my “max_bounce” 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 = get_overlapping_bodies
and compare it to the bouncing_history and that when ALL unit in units are in bouncing_history , I know that my projectile has hit all it could and i can queue_free 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 ?
thank you