Hey
So I recently tried getting back into a bit of coding, thought I'd try making a small platformer game and I'm having a bit of trouble with the collisions system. So I had a function to detect whether two objects are intersecting but this doesn't help me when I'm trying to make platforms at different heights to stand on. I have since deleted the collision function to try to come up with something new but have lost inspiration.
I've got a table called collideList which will hopefully hold all the platforms, they should be drawn in red (for testing). So all the images are drawn at a scale called worldScale based off the window size which should be around 5 for 1080p.
Thanks for any help in advance!
Bit of help with platformer collision detection
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 9
- Joined: Mon Dec 08, 2014 8:24 am
Bit of help with platformer collision detection
- Attachments
-
game.love
- (109.8 KiB) Downloaded 175 times
Re: Bit of help with platformer collision detection
You attempt to move the player to the desired position, check whether the position collides with anything, and adjust the position accordingly if a collision occurs (e.g. if player is falling downwards onto a platform, tweak the players position so they're standing on the platform). I wrote a more detailed response previously: viewtopic.php?f=4&t=85437&p=221891#p221891
There is a basic collision detection function in the Wiki, I presume you already have something similar: https://love2d.org/wiki/BoundingBox.lua
I don't know whether you're writing your own collision detection as a learning exercise, or simply trying to make a game. If the latter, I advise using an existing library for collision detection/response, such as https://github.com/kikito/bump.lua or the Physics module built into Love (which is more complex than bump).
There is a basic collision detection function in the Wiki, I presume you already have something similar: https://love2d.org/wiki/BoundingBox.lua
I don't know whether you're writing your own collision detection as a learning exercise, or simply trying to make a game. If the latter, I advise using an existing library for collision detection/response, such as https://github.com/kikito/bump.lua or the Physics module built into Love (which is more complex than bump).
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 5 guests