How do i make a projectile pierce

ill try it myself and see if it works then ill mark this solved!

always happy to help if it doesn’t work =D

If multiple darts cannot be in collision with same baloon at the same time
Then you could give darts ID variable with increasing value

Like

Fire dart blablabla
Change ID variable of dart set to Adv
Change variable Adv add 1

And now you could just check if dart is in collision with baloon
And if balloon ID IS NOT EQUAL to dart ID
If so then you damage balloon and set balloon ID to dart ID

This way each dart will be able to hit multiple balloons but only once

And don’t start with Adv 0

ahh. i see this is a strategy i think i used before =p
the (1 second) is a invincibility frame. it works but when it comes to fast firing weapons mose the bullets pass through enemy’s due to them being invincible

lemme try this :smiley:
and see if it works.

Oh ur right, sorry TT. If ur’s is a fast weapon, I’d have to rework my code =P

I’ve reworked it!(just made a smaller invisibility frame =P)

This is really useful. I could use this in my project for a badge =D

This works but now i can no longer kill said bloons. what i mean by hit once is one dart passes through and then the next kills it/multiple

works but now slower projectiles or fire rates could hit twice,

oof, do you have many types of projectiles? If you do, maybe tweak the invincibility frames for each type. :upside_down_face: (so the slower ones have a bigger invincibility frame, and faster have a smaller one =P)

yeah, i plan to have upgrades that increase projectile amounts, attack speed, pierce, etc.
it would take a while to set that up. if it is what i have to do i can do it. but ill just leave this unsolved in case of a better solution. :<

I tried it with slower bullets (it works) but can’t use slower and faster at the same time =P Super sorry I couldn’t be of assistance :smiling_face_with_tear:

In that case you need this

So, to make the bullet pierce without giving a hit object I-frames or hitting every frame, the easiest way is to give each object a unique ID, use said ID to mark that object as hit by the specific projectile, and make it so that the projectile can’t hit previously marked objects.
The easiest way to do so is to use this extension that I created to automatically handle object IDs, then to add a structure or array variable to the projectile object.

Use the behaviors in the extension to give each enemy instance a unique ID (I recommend using the incremental ID behavior, it is less demanding, especially for more objects). Then, when the projectile hits the enemy, use the ObjID expression of the behavior to get the object’s ID, and slot it into the array/structure name (it should look a little something like enemyHitID[enemyenemy.AutoIncrementalID::ObjID()]. Make that child variable a boolean, and then set it to true.

This marks the enemy as hit by that specific bullet, and during all of the next frames, it stops the projectile from hitting the enemy again.

If you want the piercing projectile to be able to hit the same enemy more than once, the easiest way to do so would be to simply toggle to above variable to false when the enemy is not in collision with the player.

Example event:
image

Thanks!

It works!

The same projectile can’t hit the bloon but a different one can!

And it works with spreadshot.

I think this needs ability to decide how many hits object can take before object ignore bullet

While also add option for deciding how many hits bullet can deal before being destroyed

Damn i just realized that is just making HP for bullet

ANYWAY i would see your extension as great addition
If you would polish it i would next time share your extension instead of my way of doing it

It does seem to fail when multiple are stacked atop each other but im sure its easier to fix.

Oh yeah forgot to add the “for each enemy” to the event.

You could just replace the boolean variable with a number variable, and make the condition be “if hits < maxhits”

Maxhits being a different variable on the object.

Show me what you did
Cause my logic is for chain lighting and not piercing
So you did not need all of it