基于玩家旋转的 Corona SDK 射击。

所以我想要相对于自行车的旋转直接发射一个抛射物。 以下是我的代码:

function shootButton:touch(event)
    if event.phase == "began" then
        if G_fired == false then
            local firePosX= bFrame.x +170
            local firePosY = bFrame.y -20

            bullet.y = firePosY
            bullet.x = firePosX
            bullet:applyForce( 23000, 10, bullet.x, bullet.y ) -- 44000
            bullet.isVisible = true
            bullet.isBullet = true

            return true
        end
    end
end
点赞