How to I have a platform behavior only work for some objects?

So I am trying to have an object (wall) where some objects can pass through, but not others. Or only when those objects meet conditions. Specifically I want my throwable objects to be able to pass through this “wall”, but not my playable character (unless they meet specific requirements, namely, they are frozen).

I thought about changing the behavior depending on which object touched it, but I don’t want people to be able to cheese it by throwing an object while they are touching it.

Does anyone have any ideas on where I can start with this, or if it’s possible?

Thank you in advance

Can you give a screen snip of the events around this?

The objects you throw should be passing through a wall object regardless, unless you have events that check and stop it, or you make the throwable object a platform character (which is not a good idea).

I haven’t started to code it yet. I’m not sure where to start on this one. But I want the object to act as a wall for the playable character, but not for throwable objects (which do interact with normal walls). For the sake of discussion though, we can say the playable character is “PC”, the wall can be “wall” and the throwable objects can be “TO”.

I want it where TO can pass through Wall, but the PC cannot pass through “wall”

I should clarify, there is code, but not pertaining to what I want to do here.

Why does the thrown object have the platformer behaviour? You might want to use the physics engine only for thrown objects instead. Either way, I see no reason for the thrown object to have the platformer behaviour.

I must be explaining this poorly. My bad

The throwable objects are physics engine objects, the player character is a platformer object, and the wall is a platform object.

But since the wall is a platform object, the throwables will bounce off of it, and if it’s not a platform object, then the player character can go through it.

I want the throwable objects to be able to go through it, but not the playable character.

If the throwables are physics object, unselect all the layers and masks found at the bottom of the Physics2 settings for the throwable sprites and see if that makes a difference.

That makes it not collide with any wall, I just wanted it to not collide with this one wall. But that does (I think) solve my issue, by simply putting the wall on a different layer. I’m new to the physics engine, so I kind of just ignored the layers on it. Do they correspond to the layers for your scene, or are they separate? If they are separate, do I need to add a physics engine to my MC to have them interact with it as well?

No, they’re layers particular to the physics engine. Here’s a link to the GDevelop wiki on physics2 layers and masks which explains how they function.

2 Likes

Thanks for the expansion on this. I at least have a place to start. I had no idea at the start of this thread.

1 Like