How to check if player in near a ledge?

So what I want to do is, if player is near ledge, (automatically) grab ledge
Why?
because there is something weird about grabbing a ledge in Gdevelop which is you have to be pressing right or left in order to grab (sometimes you reach the ledge but just because you’re not holding left or right for a millisecond the player won’t grab it), so what I need is to make it happen automatic even if left or right is not pressed.
Just If the player is near a ledge, just grab it.
So is that possible?

Thanks for helping as always :slight_smile:

Not sure what the solution is or if it even possible to make it grab the ledge without holding the left or right key since there is no event to force it to grab the ledge of selected platform or something. No idea how to go about this. I have also noticed this problem. You may be better off posting a feature request here and also on Trello to improve this or add support directly in the platformer behavior.

I think it would be useful to have this option right in the behavior to choose how to grab the ledge.

Hmm…
Yeah it’s weird it’s not included in the platformer behavior, I remember in Miko’s Adventures it was a problem for a lot of players, for me it’s simple because I know I need to keep pressing left or right to grab but the player won’t realize that…
You know I should add this one in the tutorials in the beginning of the game and force the player to try it several times so he gets the idea.

But other than that I would like to add it in the feature request but I never did that so where should I post it and how ?

Just create a topic in feature request category:

I usually include [REQUEST] in the title so in case 4ian come and read the forum few days later, he can see immediately it is a request.

Explain in detail why do you need this feature, how is it helps, how is it benefit you, what problem does it solve.
And then I would recommend to also register at Trello, post a one liner what feature you need in this card with a link to the forum topic where you explain it in more detail:
Trello

After that, 4ian or a moderator may consider to add a ticket on Trello to ideas where people can vote on the feature. 4ian consider to work on features that has more vote but of course he also got his own preferences and may decide to work on something he want to have in GDevelop. But in general the more votes you have the better chance 4ian or a contributor consider to help you out and add the feature.

Since you have already released a nice and polished game and you need this feature to complete your next project, 4ian may consider to add straight away for you when his got the time but it is up to him and the contributors to decide. But I think this request is reasonable, I hope to see it being added in the near future.

1 Like

Cool, I’ll post it there tomorrow hopefully and let’s hope 4ian try to add it very soon.
Thanks a lot my friend :slight_smile:

ddabrahim, I have good news.
I fixed it with a workaround (and without pressing any buttons)
Take a look over here:-

And here is the solution :slight_smile:
It’s very simple but effective.

4 Likes

Nice trick :slight_smile: Thanks for sharing.
However, I think it would be better if the behavior would take care of this out of the box for those who need it and I encourage you to post the request regardless.

1 Like

Yeah you’re right I’ll very soon.

Maybe it is enough to mention @4ian here.
Have been already explained in this topic what the problem and the use case is and he can decide if he believe the work around you did is sufficient or it should be indeed taken care of by the behaviour as I recommending. Would be nice to have a check box or something to choose if we want the player to grab the ledge automatically if close enough to the ledge or only if a certain or movement key is also pressed unless it is a bug and it is meant to grab the ledge either way.

1 Like

@ddabrahim really sorry for late answer, I just have been very busy lately, but Yeah that would be nice for sure, it would give more freedom to players to choose how the player behave and feel near a ledge.

@4ian you might want to take a look at the grabbing ledge mechanic because It doesn’t work as it suppose to in GD5, I tried a workaround (it works just fine) but it will be much better if the behavior would take care of this out of the box for those who need it or new to GD as ddabrahim mentioned.
Maybe add it in the next beta?

What we need is:-
Condition: if player is in collision with ledge or (near a ledge)
Action: Grab the ledge (this action is not there and it’s really needed in the platform behavior)

So it’s been more than a year and I see this new action “allow (object) to grab platforms”
.
I tried that event in a clean project but still the player didn’t grab it automatically when close to a ledge (and I have to be holding the button down), do I have to add something with it so that it works or what?
.
I fixed this problem a year ago with a workaround but it’s not ideal in anyway … so if this action works it’ll make me remove a lot of useless objects in the scene.
Thanks…

I believe this option just acts as a toggle for a sprite with the platformer behavior. Before that update, you couldn’t toggle if a character could grab ledges at all, it was all or none.

This does not make it so someone automatically grabs ledges.

1 Like

@Silver-Streak I see yeah so it’s not yet implemented then …

@4ian if you can check out this one … Maybe there could be an action you can create to make the player grab a ledge when close to it?
.
For example: When the player is near a ledge … then grab the ledge automatically without pressing a button.
.
I don’t know if it’s possible to make it happen in future updates …