Bump collision issues

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
veethree
Inner party member
Posts: 875
Joined: Sat Dec 10, 2011 7:18 pm

Bump collision issues

Post by veethree »

Hello. A while back i decided to make a platformer using bump for collisions. It worked great at first. But after some development time i changed something (don't remember what it was) and the player started getting stuck in walls and what not. This issue got very frustrating so i abandoned the project. About a week ago i decided to resume working on it, But decided to just start from scratch as the code was a horrible mess.

This time a very similar story, All going great, Bump was working like a charm. Until i changed something and collision issues arose. Except this time i know what i changed.

My player sprite has a slim body and an over-sized head. Initially the collision box was like this:
Image

And with that setup it worked great. No collision issues. Except it was a bit deceptive since the collision box is much wider than the players legs. So i decided to shrink the collision box to be roughly as wide as the players body, So now it looks like this:
Image

And at this point the collision issues started. The player seems to get stuck in walls to his right. If you're running into a tile and jump, some weird things happen. But oddly the collision seems to work fine for tiles on the players left side.


I've attached 2 .love's, One with the slim collision box, and one with the wide one for comparison.

Any help would be greatly appreciated. Thanks in advance.
Attachments
Zack from space (wide collision box).love
(27.79 KiB) Downloaded 53 times
Zack from space (slim collision box).love
(27.8 KiB) Downloaded 51 times
User avatar
arampl
Party member
Posts: 248
Joined: Mon Oct 20, 2014 3:26 pm

Re: Bump collision issues

Post by arampl »

Try to change line 35 in the player.lua to:

world.bump:add(self, 0, 0, math.floor(self.width / 3), self.height)
User avatar
veethree
Inner party member
Posts: 875
Joined: Sat Dec 10, 2011 7:18 pm

Re: Bump collision issues

Post by veethree »

That worked. Thank you.
User avatar
arampl
Party member
Posts: 248
Joined: Mon Oct 20, 2014 3:26 pm

Re: Bump collision issues

Post by arampl »

You're welcome. I'm always glad to help.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 222 guests