I had not understood löve's own physics libraries well. So I decided to create my own. So far it worked relatively well, but when I paired it with a tilemap library (which creates a collider for each tile) the character started going through walls when falling over corners.
My project is attached below (the game starts at 3th room, skipping the start screen and other stuff).
* Libs\collision_lib.lua : file that creates platforms (collisors) and returns the nearest walls
* Libs\tilemaps_lib.lua : file that open the room level file (.txt) and creates the tiles and collisors
* Libs\transform_lib.lua : character class
* Use the arrows to move and X to jump
Not a big problem, but it bothers me a little to leave "holes" on the map. If anyone can help I would appreciate
[SOLVED] Collision library does not detect character in corners
- Pixet Bits
- Prole
- Posts: 3
- Joined: Fri Apr 26, 2019 6:29 pm
[SOLVED] Collision library does not detect character in corners
- Attachments
-
- Eternity.love
- The project file
- (30.82 KiB) Downloaded 197 times
Last edited by Pixet Bits on Mon Jan 13, 2020 1:25 pm, edited 1 time in total.
Re: Collision library does not detect character in corners
Try inspecting other people's libraries, such as Bump. Then try making your own again, it'll be easy. Or, you can just use some existing library.
- Pixet Bits
- Prole
- Posts: 3
- Joined: Fri Apr 26, 2019 6:29 pm
Re: Collision library does not detect character in corners
I think I got it.
At least it worked in the parts where he crossed. I had to edit a part on the jumping command too.
Code: Select all
-- Fix bug --
if vect.y > plats[l].fr_w and vect.y < plats[l].rf_w then
if vect.x > plats[l].lt_w and vect.x <= plats[l].rt_w - 4 then vect.x = plats[l].lt_w end
if vect.x < plats[l].rt_w and vect.x >= plats[l].lt_w + 4 then vect.x = plats[l].rt_w end
end
Code: Select all
... and math.floor(self.cpos.y) ~= self.w_col.up then ...
Who is online
Users browsing this forum: Ahrefs [Bot] and 0 guests