嗨,我的“直升机物体”需要有一个身体来与敌人的物体互动。所以我得到了:
helicopterspriteSheet = sprite.newSpriteSheet("helicopters.png", 113, 55)
helicoptersprites = sprite.newSpriteSet(helicopterspriteSheet, 1, 4)
sprite.add(helicoptersprites, "helicopters", 1, 4, 1000, 0)
helicopter = sprite.newSprite(helicoptersprites)
helicopter.x = -80
helicopter.y = 350
helicopter:prepare("helicopters")
helicopter:play()
helicopter.collided = false
helicopter:setReferencePoint(display.CenterReferencePoint);
physics.addBody(helicopter, "static", {density=.1, bounce=0.1, friction=.2, radius=10})
screenGroup:insert(helicopter)
但是我怎样才能阻止重力干扰直升机,因为它是由“加速度计”控制的,但重力一直把它拉下来。
也许我可以通过 self:applyForce(0, -1.5, self.x, self.y)
倾斜来修复它,但如何做到这一点?