Sloped Tile Collision Detection in Phaser 3


Further to my earlier partial (AABB) tiles collision detection post, which ended with a demo of “pseudo” slopes (consisting of partial tiles of different heights). I have now created the following code to handle true sloped tiles. Move left, right, jump with the left, right, up arrow keys.

The code has limitations such as not handling sloped ceilings and pixel-constrained movement. I have documented how my implementation works together my learnings here so you can easily amend/add features should you be interested.