2D side scroller platformer - detecting collisions with big movement intervals

Hi all,
I’m making a 2D side scrolling platformer, where the platforms are effectively a 2D array of tiles rendered in much the same way as a standard 2D top-down game (0, 0) top left hand corner to (mapWidth * tileWidth, mapHeight * tileHeight) which is the bottom right hand corner. The player can land on tiles, depending on whether they’re set in the array, or walk into them, or bang their head on them, etc.

Gravity is acting on the player, so if they aren’t standing on a tile, they’ll keep falling faster, until they reach the end of the tile map, then they’ll fall forever. Everything’s going fine, but I’m determining collisions much in the same way as I’ve been doing in the top down games, whereby I divide the player’s position + delta movement, divide each of the player’s surrounding corners by the tileWidth and tileHeight, then loop through them, checking if they’re passable and if one isn’t, I stop the player from moving in that axis.

That’s all fine for those games because the player doesn’t move by a significant amount at a time, but obviously when gravity’s introduced the player begins to clip through tiles, because the tile features between the player’s position and the player’s position + delta movement.

Are there any standard methods of solving this problem as at the moment, when the player’s falling more than, say, 50 blocks, they can clip straight through entire platforms.

If anyone could give me any tips on this I’d appreciate it.

When the delta is greater than block size, test for collisions along the path in half-block steps.

Hiya, thanks for the reply. :slight_smile: Sounds good. I’ll have a play around with it. Cheers!

Having a terminal velocity could help avoid the problem in the first place rather than solving it.

Although if you want the player to move at insanely fast speeds it won’t do.

Yeah, that’s a good point. I probably should have set one. :stuck_out_tongue: It’s not crucial that entities move that fast. Ah well, maybe I’ll set one for the hell of it.

Anyway, got this all working now. Cheers for your help guys!