I'm having a hard time using the physics library. I started from the example in tutorial and I soon figured that the API has changed. The version I use is 0.8.0 (I think as I just cloned the repository). I looked at löves sourcecode in order to change my function calls and I wrote this:
Code: Select all
function love.load()
love.graphics.setMode( 800, 600, false, false, 0 )
love.physics.setMeter(48)
-- gravity x,y and sleep
world = love.physics.newWorld(0,9.81*48,true)
ball={}
--a simple body in the middle of the screen
ball.b = love.physics.newBody(world, 400, 300, 15, 15)
--here in 0.7.2 you'd have to specify the body the shape gets attached to
ball.s = love.physics.newCircleShape(0,0,20)
end
function love.update(dt)
world:update(dt)
print(ball.b:getY())
end
Best regards