一帧包含另一帧或其中的一部分 SpriteKit swift iOS

One frame contains another frame or part of it SpriteKit swift iOS

我正在使用 SpriteKit 开发我的第一款游戏,遇到以下问题:我需要检测一帧是否包含另一帧或至少包含其中的一部分。典型的函数是 node.contains(anotherNode.position)。但我需要检查的不是一个 CGPoint(position),而是整个帧。有人可以帮忙吗?

给定 2 个精灵

let spriteA = SKSpriteNode()
let spriteB = SKSpriteNode()

你可以检查spriteA是否在spriteB里面

spriteA.frame.contains(spriteB.frame)

Please note that this will not work with simple SKNode(s), you actually need a subtype which has a frame like SKSpriteNode, SKLabelNode, ...