Page 1 of 1
Needing Help- Non Square Collisions - STI and Tiled
Posted: Thu Dec 28, 2017 10:33 pm
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.
The controls are just arrows and I left the .love and .zip of the files.
Re: Needing Help- Non Square Collisions - STI and Tiled
Posted: Fri Dec 29, 2017 4:44 am
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?
Re: Needing Help- Non Square Collisions - STI and Tiled
Posted: Fri Dec 29, 2017 4:52 am
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.
Re: Needing Help- Non Square Collisions - STI and Tiled
Posted: Fri Dec 29, 2017 4:53 am
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
Re: Needing Help- Non Square Collisions - STI and Tiled
Posted: Fri Dec 29, 2017 12:51 pm
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.
Re: Needing Help- Non Square Collisions - STI and Tiled
Posted: Fri Dec 29, 2017 4:30 pm
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!