Further Development of Platform Collision Detection

For pretty much the entire day, I have been trying to really hammer home the platform collision detection. Yesterday, there was plenty of glitchy behaviour, as shown in the video for that blog post. I have resolved most of them today, although there are still some strange glitchy occurrences here and there.

As shown in the video above, I have been continuing to work on wall collision, as well as head collision. It is going really well at the moment, behaving as expected for the majority of the time. Head collision only truly takes place when the top middle of the sprite is colliding with a solid block. If there is collision either side of the middle (but not the middle itself), the character will be nudged over. This makes it easier to jump into gaps that are one block wide.

One other thing I’ve done today: The player cannot jump onto a ledge you cannot see the top of (example in the video). The collision detection system goes no higher than the top of the screen, and it is therefore impossible to get on top. This is by design, so that you cannot run on top of the levels. To get on top of the ledge, the camera needs to move up. This happens when you land on a high enough platform, such as the grassy one to the left of it. Note that the camera only moves up when the player actually lands on it. Simply jumping to that height is not adequate.

Leave a Reply

Your email address will not be published. Required fields are marked *