Code: Select all
objects.enemy.two = {}
objects.enemy.two.body = love.physics.newBody(world, center_x+distance, center_y+distance, 1, 1) --non zero mass so it can move freely
objects.enemy.two.shape = love.physics.newRectangleShape (objects.enemy.two.body, 0, 0,32,32,0)
objects.enemy.two.joint = love.physics.newRevoluteJoint( anchor, objects.enemy.two.body, center_x, center_y )
objects.enemy.two.joint:setMotorSpeed( -1 ) --set the motor speed
objects.enemy.two.joint:setMaxMotorTorque( 10000 ) --something ludicrously high, doesn't really matter
objects.enemy.two.joint:setMotorEnabled( true ) --turn the motor on
Code: Select all
love.graphics.circle('line', center_x, center_y, 32, 32)
local xenemy,yenemy = objects.enemy.two.body:getWorldPoint(distance,0)
love.graphics.rectangle("fill",xenemy,yenemy, 32, 32)
Code: Select all
function Play:update(dt)
world:update(dt)
--Calculate all other points
xbotright,ybotright = objects.player1.body:getWorldPoint(20,70)
xbotleft = xbotright -20
ybotleft = ybotright
xtopleft = xbotleft
ytopleft = ybotleft - 70
xtopright = xbotright
ytopright = ytopleft
if objects.enemy.two.shape:testPoint (love.mouse.getX(),love.mouse.getY()) then
dead_show = "true"
end
if objects.enemy.two.shape:testPoint(xbotright,ybotright)then
player1_dead = "true"
end
if objects.enemy.two.shape:testPoint(xbotleft,ybotleft)then
player1_dead = "true"
end
if objects.enemy.two.shape:testPoint(xtopright,ytopright) then
player1_dead = "true"
end
if objects.enemy.two.shape:testPoint(xtopleft,ytopleft)then
player1_dead = "true"
end
http://d.pr/PXf
(Ignore the black lines )
I have no idea why, or what could have caused it.
For the case that the above code is correct and the problem must lay in the rest of the code I'm going to attach it.
http://d.pr/Kie4