Go inside of the clip, “Vil,” and add in this code in its update script:
for(var a of Bul.clones){
if(this.hits(a)) {
a.remove();
this.remove();
}
}
This is everything you’ll need to do, afterwards it should work the way you wanted it to
(enemy and bullet getting both removed upon making contact).
I also recommend reading quickly through how this code works here:
Click Me
“Bul.clones
” returns an array of clones for the bullet object (“Bul”).
“for(var a of Bul.clones){...}
” sets a statement “for” all values in the array, “Bul.clones,” which you can refer to as “a” in the statement (inside the “{ }”).
The rest is simple… if this (“Vil” or its clone) hits/ touches “a” (a clone from the array), then remove “a” (the bullet clone) and remove this (“Vil” or its clone).
Here’s a cloning tutorial by Luca if your interested (this helped me a lot when I used to know nothing about clones, so I’d recommend it)