Why Doesn't This Work?

Intended behavior: have the player’s character slide down a wall if pressing left or right next to it.

Method: create objects on each side of the character and have their collision with the platforms trigger the event to cause the maximum falling speed to decrease.

Displayed behavior: the behavior only works on one side.

In one of the tests, deleting one of the objects (right side in this case) made the other side work. I don’t know why this is so but I’ll attempt this again on some older GDevelop version.

I have changed the order of events, and both of them stopped working. I don’t know how, but somehow the order of events is affecting which side works. Once I put the events back in their original place (since above) on the right size seems to work, like before. I’m aware the order or events, conditions and actions can alter their behavior, but in this particular case, I don’t see how this could be so.

EDIT 3: I was going to post “EDIT 2” but the forum didn’t allow me. I’ll try now, I’ve seen Bouh posted, I’ll read it.

1 Like

My guess: on the left side, placing the side object at the limit of the playerbox puts it inside the playerbox, while on the right side, placing the side object at the limit of the playerbox puts it outside, so collision is possible.
Maybe you should offset the position by a few pixels, change the origin points of your sides or use another method like put object around another.

1 Like

Thank you Gruk. To test, I’ve done the opposite: inserted the side objects (the 1 pixel wide things you see on the “T” character), inside the character’s sprite, with only the edges matching the character’s edges. Still, only the right side seems to work. I’ll redo the project all over, maybe on an older GD version, and see if that rectifies the issue, then update here.

It will do the same for any version because they are the same, it’s not a bug.
You say it yourself one side works and not the other, if you delete events on the one side the opposite side works.
So the events are just wrong.
Only the Right side works because it is the last one in the event sheet

See when what order the events are called for each sides.
1, 2, 3 in blue is for Left Side
1, 2, 3 in Green is for Right Side

1 Like

Thank you Bouh, it was not clear to me I had a redundant event. The issues with order of events are so subtle. I’ve changed the events and it now works, although I’m not sure what the numbers in your picture mean (though I suspect it’s the order at which the events take place). Do you know of a resource or reading material that addresses these issues with the order of events, or if there’s a better way of doing the slide mechanism?

Current event sheet, with working mechanism:

1 Like

The best way to learn is to make mistakes. Otherwise we recommend reading wiki.

1 Like