Suppose:
SKSpriteNode
, node , off doing its own thing SKCameraNode
, cam , to dictate what the player can see func onScreen(camera:SKCameraNode) -> Bool {
if camera.contains(self) { return true }
else { return false }
}
Question How can one add an event listener to node so that when node transitions from within the camera's view to out of the camera's view, it triggers or calls a function?
This looks a bit complicated....
您可以将PhysicsBodies添加到您的节点以及摄像机周围的“特殊边界”节点,然后可以使用物理委托来通知您的节点是否与边界节点相交。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.