I would like to get an explanation (I couldn't find anything in the docs) about the x,y coordinates.
I want to create a line which will start from the mouse pressed x,y and end in the mouse released x,y.
Here is the code in the mouse released function event:
Code: Select all
walls[i].s = love.physics.newEdgeShape(mStartX, mStartX, mEndX, mEndY)
Why isn't this working? (Link/answer are highly appreciated)
More code:
Code: Select all
function love.mousepressed(x, y, button)
mStartX = x
mStartY = y
end
function love.mousereleased(x, y, button)
walls.count = walls.count + 1
i = walls.count
walls[i] = {}
walls[i].b = love.physics.newBody(world, mStartX, mStartY, "static")
walls[i].s = love.physics.newEdgeShape(mStartX, mStartX, mEndX, mEndY) // here
walls[i].f = love.physics.newFixture(walls[i].b, walls[i].s, 1 )
walls[i].f:setFriction(0.1)
end