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:
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:
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.
Bump collision issues
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Bump collision issues
- 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
Re: Bump collision issues
Try to change line 35 in the player.lua to:
world.bump:add(self, 0, 0, math.floor(self.width / 3), self.height)
world.bump:add(self, 0, 0, math.floor(self.width / 3), self.height)
Re: Bump collision issues
You're welcome. I'm always glad to help.
Who is online
Users browsing this forum: Bing [Bot] and 222 guests