Hi,
this is my code and it was working before I give shape to the object : [lua]jet = display.newImageRect(“jet.png”, 70, 37)
jet.x = screenLeft - 65; jet.y = screenTop+100;
screenGroup:insert(jet)
physics.addBody(jet, “dynamic”, {density = 2,friction = 0.1, isSensor = false,
shape =
{27-50, 35-20, 19-50, 30-20, 20-50, 7-20, 39-50, 6-20, 66-50, 11-20, 77-50, 23-20 } })
function activateJets(self,event)
self:applyForce(0, -1.4, self.x, self.y)
end
function touchScreen(event)
if event.phase == “began” then
if event.x < rightMarg-150 then
print(“yoho”)
jet.enterFrame = activateJets
Runtime:addEventListener(“enterFrame”, jet)
end
end
if event.phase == “ended” then
Runtime:removeEventListener(“enterFrame”, jet)
end
end
Runtime:addEventListener(“touch”, touchScreen)[/lua]
how can I fix this ?
it’s supposed that the jet will get force to fly, but after adding the shape, it’s failing to get any force.
before the shape the density = 0, but after that, it acts weird if i set it to ‘0’ so I set to 2.