Spritekit 中的动画风?

Animating wind in Spritekit?

有没有办法为某些游戏设置风动画objects?

例如,树枝应该轻轻移动,就像游戏中的breeze一样。不是游戏玩法,更像是一种特殊的背景效果。


如果无法在代码中实现,创建合适的精灵图像的最佳方法是什么?

我看到了一些实际实现风效果的选项。

  1. SKFieldNode, It allows you to actually apply physics effects to nodes. And if you want real tree branches that can move based on the physics, you should combine SKFieldNode with SKPhysicsJoint. When you combine those two you can actually create indepedent Branch Nodes to receive some kind of force to simulate a wind effect. To understand what you can do with SKPhysicsJoint, check out this guide。如果对 SpriteKit 引擎有肤浅的了解,这个解决方案可能会变得非常复杂和难以实现,但您可以使用它创建惊人的效果。就我个人而言,如果你有截止日期,我不建议参加,如果你对自己正在做的事情失去把握,物理学总是会出问题,你可能会投入大量时间尝试使用物理学来实现这一目标。
  2. 根据风的运动创建不同的树动画,并控制在特定情况下应使用哪个动画帧。我强烈推荐这个,因为你可以控制树上发生的事情,而玩游戏的人不会太注意背景发生的事情,不过从游戏体验。
  3. 创建你的树纹理并改变它会得到的anchor point to be at the place you want the effect to be more effective and responsive. The farthest the coordinate in the node is from the anchor points coordinate, less effect from your SKAction

抱歉我的英语不是我的母语。