So, the character is practically 2D, it has a gun with a key collision, and there is a lock collision above the character, a sensor to see if there is any trespassable surface below,and also there is the trespassable surface at the question below it. What we supposed to get is, when the player aims above, when gun and lock collisions are overlapping, if the player presses the S key at the same time, the surface which is overlaping with the sensor collision should be ignoring for 1 second. How can I achieve that? I am quite of a newbie sorry, I will be thankfull if anyone could help.
By the way, every component except the trespassable surface here is a part of the character. And there will be multiple trespassable surfaces along the map.
Tbh I have no idea what you are actually doing, so my guess would be only a guess. I usually try to think about it this way:
if it’s the character’s ability – do it in the character.
If it’s a feature of the surface/object, then do it in the surface/object.
For example, if you have a barrel that explodes when hit, you should script it in the barrel. But if it’s an exploding bullet, then you script the bullet instead of every possible surface it can hit.
Hope it helps. In the end, in my experience (which might be different for others), deciding what goes where and how to organize scripts and stuff is one of the most difficult things, because there are always hundreds of ways to do things, and none of them is perfect – you just need to find the least bad one