Generate Singular Hit Event For Gameplay Decisions

First ever post so not too sure how much info to give.

I’m making a multiplayer physics game. When two characters hit each other they are both calling an event dispatcher in the pawn, this then informs the gameplay manager that a collision between players has occurred.

When hits happen both players collision spheres trigger event hit, is there a way to aggregate them into a single hit event. Players collide once but trigger two hit events.

My problem is that I want to make various game decisions off of this, for example shaking the shared screen.

hi @lenc13,
you can send the two hitters through your dispatch event to your manager and compare the two entries with a previous one saved in a variable. This way you’ll be able to filter doubles. That’s not very elegant but it should work.
You can also implement some kind of stack design pattern with a discard if an effect is already playing (a screen shake like you said) so only the first one will be triggered.

Okay, both should work for me haha! Thanks so much for the stack pattern info, I’ll go read up on it.

1 Like