【问题标题】:How to fling the sprite in the direction of a swipe SpriteKit如何向滑动 SpriteKit 的方向投掷精灵
【发布时间】:2020-08-20 19:30:33
【问题描述】:

所以我想出了如何通过滑动左右上下移动我的精灵,但我想知道是否有办法让精灵根据用户的滑动方向向任何方向投掷。如何在 SpriteKit 中做到这一点

【问题讨论】:

  • 请贴出你目前已经实现的代码

标签: swift xcode sprite-kit uipangesturerecognizer


【解决方案1】:

SKPhysicsBody使用func applyImpulse(_ impulse: CGVector)

https://developer.apple.com/documentation/spritekit/skphysicsbody/making_physics_bodies_move

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多