Project Under is an aRPG/Platformer currently in development by two guys who share the same passion for video games. It is still on the early stages of development but with steady progress.

Report RSS Collision Detection Revamped and Testing

Posted by on

This past week I've been working on redoing how I handle the collisions in the game, previously it was a posteori collision system, basically the collision had to occurr and then react accordingly.The problem is that the collision already happened and part of the collision box was already inside the tile. Another problem with this is the fact that if the body of the object moved too fast it could go through another body without having a collision, this is also known as the "Tunnel Effect".

To solve this I had to redo some code and make it a priori collision system. Since I use tiles on this game basically I traced a line downwards and check the first tile that is collision able, then I get the tile information (position on the Y axis) and that would be my lowest position for my character. After that before I moved my character I stored the information on a variable then checked if that movement would go lower than my lowest position available, if it did then my new position would be my lowest point, if not then I moved my character with the given value.

We also added the sky background, full color on the character and the idle animation. I'm still working on the physics, I think I nailed it on my neutral jump and neutral jump with movement, but still have a long way for my moving jump. Here's a short video showing the implementation so far, please note that we don't have a jumping animation that's why it looks so funny when it jumps.

If you have any questions feel free to ask!

- Noe

Post comment Comments
zackaria99
zackaria99 - - 10 comments

For the jump, I know you don't have the animation yet, but in terms of the speed, it looks like the jump starts slow, then speeds up at the top. I think the reverse is true in real physics- you start fast, then slow at the peak, then speed up again on the way back down. Not that you have to use real physics or anything, but I noticed that right away.

I like how you did the foreground and background graphics, btw!

Reply Good karma Bad karma+2 votes
PROJECTUNDER Author
PROJECTUNDER - - 3 comments

Yes, you are correct. I made some adjustments to my jumping formula and now it's working better, will post another video once my friend finishes the animation for the jumping.
Thanks for the comment!

Reply Good karma+1 vote
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: