Enable/Disabling Platform collisions

Hi everyone, newbie alert, just started using GD.

I’m testing it out by trying to implement an old favorite but I’m stuck at its basic feature. See the picture:

Black (Jack): object, mechanism platformer
Red: object, mechanism platform
Pink: plain object

Purpose: Jack should be able to walk on red platforms. Jack should not be able to jump through red platforms. Unless: Jack is in collision with pink plate; he should jump through or fall through the plate.

Tried several different event/action combinations, none of them successful. Although I think the simplest one, see below, should work. It doesnt. Jack is able to walk on the platform even when on top of the plate. Jack is not able to jump through the plate; several attempts and Jack gets his head stuck to the ceiling :slight_smile:

Probably very simple stuff, newbie alert once again :slight_smile:

To check that deactivating platform automatism works, delete the “Jack is jumping condition”, this way, when Jack collides with Opening should fall :slight_smile:

This doesn’t work for jumping to the next platform because while Jack is jumping, he doesn’t collide with Opening, the condition is not fulfilled (maybe the condition is True for a frame, I don’t know). You could achieve it, for example, deactivating the platfrom when Jack is going to jump and collides with Opening (Up key is pressed, Jack is on floor, Jack collides with Opening ===> Jack jumps, deactivate platform automatism), and keep the platform deactivated for some time, a time a bit smaller than the time it takes to jump and fall to the next platform. You can achieve it with variables too, this way you should have more control, not depending of time :wink:

If you have problems, share your project (a zip file with resources is preferable), or ask us any doubt :smiley:

Yes, I tried that before :slight_smile:. Jack is unable to jump through the pink opening. When it collides with the bottom pink opening Jack gets stuck.

Nope. :slight_smile:

Thanks for you reply and your help. Checkout project/resources file below. Any help would be helpful :slight_smile:
JumpingJack.zip (20.8 KB)

Some progress…

Added some tracking variables. Jack now goes from one border of the screen to the other.

The “openings” are “detected” (see above) but their intended behaviour doesnt happen (ie going through to upper/lower platform). When jumping up at a “opening” Jack bounces and then falls through all platforms (the action to disable the platform automatism works but not before Jack is coming down). When Jack walks on an “opening” its detected; but he gets stuck (ie doesnt fall through to the lover level). Strange behaviour: if you approach an “opening” below Jack’s feet and you do it while jumping all the time, sometimes you go through the plataform above. The platform automatism is disabled and then you can fly around :slight_smile:
JumpingJack.zip (24.3 KB)

Excuse me for the delay, I was very busy :neutral_face:
:exclamation: First of all, it seems that there is a bug in the HTML5 platform, when deactivating the Platform automatism :frowning:
So I continue with the native platform, I tried with a bigger collision mask for the Opening, and checking the collision with collision masks, It (usually) works :stuck_out_tongue: :
JumpingJack.zip (24.6 KB)
As you can see (run with native platform), it isn’t perfect, while you go through an Opening, you can go through the platforms too, not so good…

Just out of curiosity, why do you do it this way instead just leave some holes between platforms? :slight_smile:

Because they (should) move…

youtube.com/watch?v=iKyyKVUm5DA

:slight_smile:

Good news, there is no bug (no a major one), but you can’t deactivate the platform automatism of an object twice, in the HTML5 platform. Before deactivate an automatism, ensure it is activated :slight_smile:

Found out why Jack gets his feet stuck on an opening: the pink opening is 1 bit above the red platform. Jack cannot pass. But if I align the opening pixel perfect with the platform then Jack goes through. But then there’s no collision and I cant detect that collision and disable the platform automatisms so he falls through. In case its an opening above Jack the same thing happens: Jack collides with the opening