Right way of dealing with Enemies, Bullets, Explosions

Almakos

  • Posts: 632
Hi,
I've got some enemy actors who shoot bullets and when those bullets collide with Player's bullets, they explode.

What is the right way to organize this?
Is it better to make explosion a separate actor which will be spawned when two actors collide or it is wiser to make explosion as animation of bullet and trigger it on collision?

In the first approach I am not sure I know how to kill newly spawned explosion actor and in the second I don't know how to make explosion stay on place where it was spawned and ignore all further collisions.

How would you advise me to accomplish this?

Thanks.

Fishing Fantasy Trailer


Ryusui

  • Posts: 827
Making an explosion actor is the right way to go.

Disable its physics - unless, of course, you want the player to be damaged by the blast; in which case, make its collision a sensor and disable its movement. Kill it when it's done its thing either by adding a "do after X seconds: kill self" under an attached When Created (either a behavior or an event), or by testing if it's showing the final frame of its explosion animation (if you want to do it that way) under Always and killing it if it is.
In the event of a firestorm, the salad bar will remain open.

Almakos

  • Posts: 632
Thank you, Ryusui. Very nice tips.
Fishing Fantasy Trailer