Issue about temporarily disable collision.

roroeow7

  • Posts: 1
Hey Guys.
สอนสเต็ปบอล
Is there a way to disable the collision of an actor (with a collision box) at run-time without:
1. Creating a fake animation and removing its collision box then having to switch to said animation and back over and over to simulate this.
2. Creating an entirely different actor with the same appearance but no collision box and switch out the current actor back and forth.

If it helps, the reason behind asking this question is that I've created a laser penetrates through and damages enemies. Due to rapid collision and the fact that this laser does not dissipate until a few seconds, this results in enemies being hit around 427 times, which makes it extremely difficult to balance and control its total damage. I'm trying to lower the amount of times an enemy actually collides with this laser and takes damage (while still in it) without having to do something that disrupts the current animation of the laser or do something that requires me to create a whole new actor on the scene for a problem that deals with just 1.

Any suggestion would be appreciated.
Thanks in advance.

Luyren

  • *
  • Posts: 1670
When colliding with an enemy, add that enemy to a list attribute (set this list to "create new list" in a created event to initialize it). Then, on your collision code, only deal damage if the list does not contain the collided actor. You can add actors to lists and check for them using the "actor" block under Scene > Actors > Get Actor.

You can also make your actors invulnerable to damage for a short period of time after being hit. In your laser's collision code, you can get an attribute from the last collided actor (the enemy) that corresponds to this invulnerable state. If it's true, don't apply the damage.
Working.