Platform sprite not reacting properly when jumped on

I have a collapsing platform that works perfectly when you walk across it but if I jump on it I can do about twenty jumps before it actually disappears (it shrinks and fades super slowly).

I’m at my wit’s end with it. :frowning:

1 Like

Your condition says “gamer is in collision with platform”, so the platform doesn’t fade when you’re jumping above it.
Change your events if you want a different behavior (which you haven’t explained).
Maybe you’d prefer to activate the platform fading once and for all (using an object variable) as soon as gamer touched it, no matter if he remains in collision with it.

Surely for the character to jump it comes into contact with the Collapse platform sprite?

The platform is set to fade/disintegrate over a set period of time the Gamer is in contact with it (it will completely disappear in the time it takes to walk across it). If you jump onto it then off it counts as one of, say, two seconds you can stand on the platfrom before it’s gone. I just need every landing to count as a hit.

Does that make more sense? If you jump on then off it will be a bit more broken each time but not gone until the time spent on it criteria is met.

I think every landing counts as a hit already.
You subtract 20 opacity. The maximum opacity is 255, so you currently need 13 hits.

Maybe you should set up a separate event for jumps, to subtract 100 each time?

I wondered that too. This is my first project so I’m very much still learning.

Is it better to work it on a time delay as opposed to a variable for contact on the collapsing floor? A variable would count every hit whereas I guess my timed register counts a fraction of a second for every jump (which is why I think now it doesn’t work correctly when jumping)?

First, you need to define precisely what should happen in each situation : what should happen if the player lands on it, what should happen if he walks the first half and jumps… Should the fading never stop once started, or only increase when the player is on the platform. etc.
After that, convert your well-defined logic using the available conditions and actions.

For instance, if the fading should never stop once started, you could start a timer on collision and increase variable Touched by 1, and if the player is still in collision with the platform after, say, 0.2 sec, increase Touched again to trigger the fading. If he jumped in the meantime, next landing will turn Touched to 2 and trigger the fading.
In that case, your conditions would only trigger the timer action and variable change, and another block of events would use the Touched variable as condition to trigger all the fading/resize actions.

On a side note, if the three platforms share the same behavior, create a group of objects (in the scene tab) and you will have only one block of events that will apply to all the members of the group.

1 Like

Okay. I thought I’d got it nailed but now it’s doing very odd stuff. My code is thus and it works perfectly for single lines of collapsing floor.

There’s twelve of these in all as each platform will collapse at different rates depending if you jump and on off or just walk over - or walk on briefly then jump. I added twelve, when I was originally just using three, because if I stacked them one on top of the other and jumped onto the bottom one all instances of that sprite reacted at once - even when I was only stood on the bottom one. I thought if I had more they all act independantly (which they might!).

Anyway my problem is I need a level where a whole bunch of these are stacked. I need to be able to drop below the line of some and walk on the ones below, leaving the ones above untouched. I thought the code should just work but it does odd control stuff. Sometimes the player sprite sticks on a frame and kind of slides along at a snails pace (either direction) and sometimes it starts walking along all by itself.

Does anyone have an idea what the hell I’m doing wrong or am I asking to do more than it can?!

Your events are kind of weird, I’m surprised they ‘work perfectly’.

  • the first block: “timer is not greater than 0 - reset the timer”.
    Because of this, I’m guessing either the first or the second block never gets executed.

  • CollapseWait1 is a scene timer, so if you have several CollapseFloor1 or if you use the same timer name for other objects, the events will only apply to the “first” one.

  • Opacity of object >240 : considering that you subtract opacity above, I’m guessing you start at maximum opacity, which is above 240. if you subtract 28 or 31 to 255, you’re going under 240 and the condition will never be true.

  • unclean events in general: means you can rearrange them (using sub-events) to make them easier to read/understand/troubleshoot/process.

No, you’re not asking more than it can do, you’re just not asking properly.
Don’t pack a lot of conditions and actions and click preview and expect it to work. Until you have a good understanding of GDevelop, build your events little by little, to see where and when things go wrong.
“Now that I add this condition, it should only happen then”. “Now that I add this action, it should do that instead.” And click preview to confirm if you were right. If it means going through a whole level to check, make your own cheat codes (x is pressed, change position of player to …).

All that being said, I’m not sure the issues you mention are related to these events. :man_shrugging:

The opacity was my issue! Once I’d set it to <1 it all works perfectly. I don’t know what to say. I could run an entire line of block 1,2,3,1,2,3,1,2,3 and they all worked exactly as I wanted with the original code. Now, changing the opacity to look in the right direction(!), my stacked level works exactly as I wanted.

You realise that to get a greater understanding of GDevelop people might need a little help? The wiki, for my way of learning, isn’t great (and a lot seems out of date for GD5). I find it easier to learn and adapt from code I can see working. People having a go should be encouraged and gently guided otherwise they will just get frustrated and give up. I recall being quoted the “give a man a fish” saying by a forum user - The problem is a man needs to be taught how to catch a fish first and not just be given a stick and some string then told to figure it out himself.

Don’t get me wrong. I greatly appreciate that you’ve taken the time to reply and you HAVE helped me - It’d just be nice if you’d be a bit gentler with replies when people are still learning and trying to realise their game visions.

That’s looking at someone fishing, grabbing a stick and expecting to figure it out.
It’s much easier than boring documentation, indeed, but looking at your events, it’s obviously not working well for you.
Learning means following some tutorials and reading the wiki a lot (and proceeding slowly with trial and error, as explained above, until you understand the logic of GDevelop and its tools).

You’re starting to learn a new software, you haven’t read the user manual (wiki), your events hardly make sense and yet you wonder if GDevelop may not be powerful enough for you (quote: “am I asking to do more than it can?”). Show some humility, take some time to read the huge documentation that dozens of volunteers have written for learners like you, and I’ll be nicer.

Anyway, good that you fixed your issue, I’m closing this topic before further digression.

1 Like