Thank you so much for trying it! I really appreciate it.
The movement is based on a 16 x 16 tile grid.
The code finds the row directly under the player by taking the Y coordinate at the bottom of the player and dividing it by 16.
For example, if the player center is at Y = 136, the player is 16 pixels tall, so the bottom of the player is around Y = 144:
144 / 16 = 9
That means the code checks row 9 for the supporting tile.
It does the same calculation with the player’s X position to find the tile column. For example, if the supporting tile is at column 5, row 9, the player is standing on tile (5, 9).
Because the player only moves right, the code then checks column 6.
The normal path tile would be:
(6, 9)
A one-tile-high stair would be:
(6, 8)
To distinguish that stair from two stacked tiles, the code also checks:
(6, 7)
If (6, 8) exists but (6, 7) is empty, the player jumps onto the stair. If both (6, 8) and (6, 7) exist, it is a two-tile-high wall, so the player stops.
If (6, 9) is empty, the code searches downward through column 6, starting from row 10, until it finds a tile to land on.
And yes, making a hole and repeatedly dropping down as the enemies approach is a completely valid strategy. :)