Question about physic objects
Posted: Sat Jul 16, 2011 1:35 am
I try to make my own physic object with some image, but image dont match with physic model.
size of image 56x56 . here is a code for example
Thats screenshot shows how look that in game
size of image 56x56 . here is a code for example
Code: Select all
function love.load()
love.graphics.setLineWidth(2)
world = love.physics.newWorld(-650, -650, 650, 650)
world:setGravity(0, 150)
boximage = love.graphics.newImage("love_cube.png")
boxbody = love.physics.newBody(world, 150, 0, 150 , 45)
boxshape = love.physics.newRectangleShape(boxbody , 150, 0, 56, 56,9)
end
function love.update(dt)
world:update(dt)
end
function love.draw()
love.graphics.polygon("line", v.s:getPoints())
love.graphics.draw(v.i, boxbody :getX(), boxbody :getY(), boxbody :getAngle(), 1, 1, 28, 28)
end