我应该手动定位 Node 还是使其成为 parent 的 child
Should I manually position Node or make it a child of a parent
我有一个人SKSpriteNode 精灵。他正在用大约是他身高一半的手(middle-right 精灵的边缘)捡起一个苹果。我应该让这个苹果成为精灵的 child 还是应该在每次更新时手动计算位置?
如果苹果 sprite 必须根据手 sprite 移动,那么将手的 apple 子对象设为手,让 SpriteKit 为您完成工作。
Also other geometrical transformations (like rotation and scaling) are automatically reflected from the parent to the child as well.
根据经验,尝试将尽可能少的代码写入更新方法。
我有一个人SKSpriteNode 精灵。他正在用大约是他身高一半的手(middle-right 精灵的边缘)捡起一个苹果。我应该让这个苹果成为精灵的 child 还是应该在每次更新时手动计算位置?
如果苹果 sprite 必须根据手 sprite 移动,那么将手的 apple 子对象设为手,让 SpriteKit 为您完成工作。
Also other geometrical transformations (like rotation and scaling) are automatically reflected from the parent to the child as well.
根据经验,尝试将尽可能少的代码写入更新方法。