Best way to damage multiple individual instances of objects, with multiple individual instances of objects

So I’m trying to have two bullets fired at once from a weapon that strikes an enemy, or multiple enemies, at the same time, but it looks like only one bullet registers damage, using the Trigger Once option.

It works when I just base damage per frame of the collision, but this may be too complex and not consistent.

For each object works (i.e., for each bullet), but this just cause performance issues.

Anyone have any experience with something like this? Thanks!

“Best way” = use a behavior
There’s a bullet behavior, and you can make another behavior or customize that one, if it doesn’t fit your bill.

I agree with Gruk, the behavior will likely be your easiest bet.

That said, to be clear:

For each bullet is exactly what you’re tyring to do, and is exactly the right way to do it. Performance issues shouldn’t occur unless there’s some wild stuff going on with your events. I’ve done some tests with over 1000 bullets on screen at once, with custom For Each events (not using the behavior) and had no performance impact.

Really? Thanks for the advice, I’ll probably just go with For Each.

Do you think it would be more efficient to have a general overarching For Each condition (i.e., bullets are in collision with group: enemies), and then the individual enemy events underneath (as each enemy takes different damage based on resistances, etc).

Or For Each for every individual case of enemy?

Thanks again.

What I would recommend (and am doing) is defining everything generalized as variables on the objects, so the events can reference the variables and it does the hard math all in the same event.

e.g. The action would basically be something like Modify Object Variable “HP” (Subtract) Player.Variable(Atkdamage)*Enemy.Variable(Resistance)
Or something like that.

Edit: Just to be clear, having this defined on your enemy objects mean you literally only need one set of events rather than custom ones for every enemy type.

1 Like

Yeah, I was thinking of compromising everything into one event and using variables for resistances, but I wasn’t sure, but since you suggested it I’ll probably wind up doing that. Would simplify it so much. Wish I had thought of that when I started the project! Thanks! I’m gonna spend the time to do it that way just so I can consolidate the processes.

1 Like