Needing Help- Non Square Collisions - STI and Tiled

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
wbat24
Prole
Posts: 4
Joined: Wed Oct 18, 2017 10:59 pm

Needing Help- Non Square Collisions - STI and Tiled

Post by wbat24 »

I am building a small platformer in which I am using bump for the collisions and Tiled/STI for the tilemap. I drew polyline points around all of the tiles for the collisions, but all of my tile collisions are still square. I tried adding a Shape: polyline to the properties of my tileset, but ended up getting an error. As well, adding map:bump_draw() gave me an error on the bump file. When I looked for others with a similar problem, I could find no working links or useful information.
What I am requesting is some advice [or corrected code] on how to make non square collisions work for my libraries. Thanks in advance for all of the help. :awesome: The controls are just arrows and I left the .love and .zip of the files.
Attachments
level1.zip
(10.6 MiB) Downloaded 135 times
level1 (2).love
(10.6 MiB) Downloaded 158 times
User avatar
jojomickymack
Prole
Posts: 45
Joined: Tue Dec 26, 2017 4:52 pm

Re: Needing Help- Non Square Collisions - STI and Tiled

Post by jojomickymack »

Your game is FANTASTIC!

Unfortunately I think what you're trying to do with non-square collision boxes is not what 'bump' is intended for - from github:

Lua collision-detection library for axis-aligned rectangles. Its main features are:
bump.lua only does axis-aligned bounding-box (AABB) collisions. If you need anything more complicated than that (circles, polygons, etc.) give HardonCollider a look.

When you call world = bump.newWorld(32), you've set the cell size to 32 x 32 and that's how bump works.

Still, there's the physics library - that has much more sophisticated collision detection but it's a lot harder to use.

https://love2d.org/wiki/Tutorial:Physic ... nCallbacks

What shapes in your level were you trying to do non-square collision with? Maybe you should attach your tmx file? Your game seems to be working great just with bump, I'm curious where you're encountering bump's limitations specifically?
User avatar
jojomickymack
Prole
Posts: 45
Joined: Tue Dec 26, 2017 4:52 pm

Re: Needing Help- Non Square Collisions - STI and Tiled

Post by jojomickymack »

I'm just checking the bump demo over here at
https://love2d.org/forums/viewtopic.php?t=78086

You might just want to have smaller cells and maybe put collision boxes in strategic positions to collide with? That's a way to keep the bounding box approach and achieve the more dynamic collidable shapes you want.
User avatar
zorg
Party member
Posts: 3444
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Needing Help- Non Square Collisions - STI and Tiled

Post by zorg »

There's also HC which does support other shapes yet still is more "gameistic" in terms of physics than love.physics (box2d) is: https://github.com/vrld/HC
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
MrFariator
Party member
Posts: 512
Joined: Wed Oct 05, 2016 11:53 am

Re: Needing Help- Non Square Collisions - STI and Tiled

Post by MrFariator »

In the case all you need to add is slopes, then bump works perfectly fine for that (gif). If interested, I wrote a little breakdown here. For anything more complex than shapes made out of squares and triangles, however, you will have to look elsewhere, like HC as Zorg pointed out.
wbat24
Prole
Posts: 4
Joined: Wed Oct 18, 2017 10:59 pm

Re: Needing Help- Non Square Collisions - STI and Tiled

Post by wbat24 »

Thank You all for the VERY helpful responses!
After looking through all of the online links and comments, it was blatantly clear that bump does not do non-rectangular shapes [I don't know how I could have missed that]. What I think that I am going to do is turn all of non-square platforms [ex. the flower pots or barrels] into non collidables and then input them into main.lua as individual boxes with a function similar to the one bump-simpledemo.love, kinda like I did with the player. I probably would have switched to HC or box2d, but I have to have this done by the end of the semester and I don't really have that much time to learn a new collision system.
Again, thanks for all of the responses!
Post Reply

Who is online

Users browsing this forum: No registered users and 211 guests