How do I turn off collisions for one actor only?

corbanwolf

  • Posts: 143
I want to [turn off collisions/make them sensors/remove collision with tiles] for one or some actors but only for a certain amount of time. After let's say 5 seconds. Their collisions and shapes are back to normal

JeffreyDriver

  • Posts: 2020
Use a custom event in a behaviour attached to the actors that when triggered, removes the collision shapes, then in the same custom event, 5 seconds later the shapes are recreated. Or you could just turn them to/from sensors.
Current Projects:
The Grand Grimoire Chronicles Episode 1 now on Kongregate!.
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk

corbanwolf

  • Posts: 143
I need more versatile approach. I need them to be changed when touching a specific actor. So I never know which actor will it be. And it's not versatile to put the same code or the same behaviour in every actor.
But if I turn them all to sensors, I would have to turn them back to solids. And not all of them were solids before

JeffreyDriver

  • Posts: 2020
Well, it's still possible. You can check if an actor collides with a specific actor or an actor of type. You can also assign collision shapes groups so you can handle them that way.
Current Projects:
The Grand Grimoire Chronicles Episode 1 now on Kongregate!.
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk

corbanwolf

  • Posts: 143
How do I do this? I got all the rest of the code.
I just need the code for collisions

JeffreyDriver

  • Posts: 2020
The code shouldn't be that complicated, especially if it's in a behaviour attached to your actors. Can you post what you have so far?

The basics are this:
If self collides with an actor of type
Trigger EVENT
When EVENT happens
For each collision shape of actor
If collision group for collision shape equals WHATEVER
Make collision shape a sensor

After 5 seconds
For each collision shape of actor
If collision group for collision shape equals WHATEVER
Make collision shape a solid
Current Projects:
The Grand Grimoire Chronicles Episode 1 now on Kongregate!.
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk

corbanwolf

  • Posts: 143
I got exact code right now. What I meant is this way all shapes will go to solid. What if some of them were sensors before and turning them into solids will not help me. But after a second thought, I can stick with this code, thanks tho ;3