I'm having problems with collisions in my game

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
MaxGamz
Party member
Posts: 104
Joined: Fri Oct 28, 2022 3:09 am

I'm having problems with collisions in my game

Post by MaxGamz »

I am using Box2D for my physics and I am having trouble my player clipping into the walls and getting stuck in mid air, I am trying to simulate zero gravity in my game or at least an underwater feel so I'm not sure if that could be the cause

The controls are the standard "WASD"

I also have trouble getting the player to appear clearer after scaling it up
Attachments
Game.love
(13.66 KiB) Downloaded 31 times
User avatar
Azzla
Prole
Posts: 39
Joined: Sun Mar 29, 2020 2:23 am

Re: I'm having problems with collisions in my game

Post by Azzla »

For the scaling problem (assuming you're using pixel-art) use

Code: Select all

love.graphics.setDefaultFilter('nearest', 'nearest')
For the collision problem, I recommend just switching to something simpler like bump. It is fast, comes with several ways to handle resolution, and is generally good for axis-aligned platformers like yours.

If you want to stick with Box2D, please provide a snippet of your collision code.
libraries: Stalkpile
electronic music stuff: https://soundcloud.com/azzlamusic
User avatar
knorke
Party member
Posts: 262
Joined: Wed Jul 14, 2010 7:06 pm
Contact:

Re: I'm having problems with collisions in my game

Post by knorke »

the body might get stuck because it rotates when sliding along the walls and corner.
you only use its x,y position for drawing but not the rotation angle.
so your graphics and the physics body are not fully in sync.
there is a function to set fixed rotation, try that.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest