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

前端 未结 6 2023
予麋鹿
予麋鹿 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:14

    Not directly but you could use its position to check. Therefore you might do something like:

    if (/*the node's position is between 0 and the screen's .x and .y*/) {
        //on screen
    }
    

    Hope that helps :)

提交回复
热议问题