Collision Detection of "partial" tiles in Phaser 3

Following my posts on various platform mechanics, I set out to create code to make player walk along sloping platforms like the Ramp Stage of original Donkey Kong game. The tiles in the Ramp Stage are not actually sloping tiles, but are series of tiles of different “heights”, i.e. they are “partial” rectangular tiles. My demo code can be accessed below.

Use the left and arrow keys to move Mario, and the up arrow key to make him jump. He does bump his head against the girders above and he can not climb ladders (although he can jump up to the scaffolding above).

Originally I tried using the customSeparate properties to achieve the desired outcome but I gave up and ended up creating a simple physics engine from scratch (CozyPhysics engine) which was both fascinating and frustrating. For those interested in how tile based collision detection works (or indeed how Phaser’s arcade physics does it), you might be interested to read my blog which documents my learnings in developing my Cozy Physics engine.

Pixel Perfect Tile Collision in Phaser 3 (here, here, here, here)
Partial Tile Collision in Phaser 3: The Basics (here)
Partial Tile Collisions in Phaser 3: Climbing “Slopes” (here)

1 Like