When you create a rectangle in Box2d, "x" and "y" are the center of the rectangle, not its top left corner. Create the ground rectangle at the bottom-center of the screen.knarf wrote:Also, I still don't understand why I have to set a width of 2*window_width (see code) to actually get a width of window_width for the ground.
Also, when you create the world, you can do just
Code: Select all
world = love.physics.newWorld(0, 0, width, height)
Code: Select all
world = love.physics.newWorld(-width, -height, width, height)
For the correct positioning of joints, try using less magic numbers and more meaningfully named constants in your code. It will be easier to understand it and spot the bug then.