Continuing my exploration of various mechanisms in platform games, this time it’s about implement “one-way” platforms (i.e. those platforms that you can jump “through” from the bottom but can land on top) and “Pass through” platforms, i.e. those ones where you can fall through by pressing down.
I have created example code using Arcade Physics Sprites, and documented my findings here.
Thank you Samme!
Your addition makes it so much easier to illustrate the idea I am trying to share!
What is interesting (I didn’t know until I saw your debug lines) is that for tiles set to collide via this.platforms.setCollisionByProperty({collides: true});, all the 4 faces, including the non-interesting faces have their collision flag set to true.
I see - you are cancelling collisions on the player sprite as opposed to the platform, and restoring it 200ms later. As you say it will affect other collision detection for that 0.2 seconds, albeit only in the vertical collision detection I guess. My version would also suffer from other unintended objects passing through the platform too…I hadn’t thought of that.