How do you tell if a node is on the screen spritekit swift

前端 未结 6 2025
予麋鹿
予麋鹿 2020-12-09 12:48

I am trying to figure out how to determine if a node is visible on the screen or off the screen. Is this just a true/false property of the node? Thanks. (Using swift spritek

6条回答
  •  醉话见心
    2020-12-09 13:32

    You can use the following to test if a node is in the scene:

    if (!intersectsNode(sprite)) {
      println("node is not in the scene")
    }
    

    This assumes that self is an SKScene subclass, such as GameScene.

提交回复
热议问题