嗨,我的'直升机对象'需要有一个身体与敌人物体互动。 所以我得到了:
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)
倾斜修复它但是怎么做?
答案 0 :(得分:1)
通过添加helicopter.gravityScale = 0
来修复