sprite-kit - Sprite Kit 在屏幕外从父级中删除 SKNode

标签 sprite-kit removechild skspritenode sknode

我想知道如何在屏幕外删除我的 SKNode 以帮助我的游戏运行更流畅。
如何在 Sprite Kit 上做到这一点
非常感谢

最佳答案

https://stackoverflow.com/a/24195006/2494064

这是一个答案的链接,该答案删除了离开屏幕顶部的节点。您只需复制它以覆盖整个边界并将所有墙壁设置为具有相同的 contactBitMask 值。

基本上,逻辑是当 SKSpriteNodes 接触您在可见屏幕外休息的物理体时删除它们。

关于sprite-kit - Sprite Kit 在屏幕外从父级中删除 SKNode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24398857/

相关文章:

swift - 如何在不出现性能问题的情况下暂停和停止 SKScene?

swift - 由于以下错误 (Sprite Kit),iAd 横幅广告无法正常工作

iframe - 删除 iframe 时如何触发 onunload 事件?

ios - Sprite Kit 不会停止添加节点

ios - touchesMoved 在特定的移动对象上

iOS - bodyWithPolygonFromPath : Body is the same as the path but collisions are not working properly

ios - Swift 3 沿用户绘制的路径生成均匀间隔的 SKSpriteNodes

swift - 在多个位置产卵

actionscript-3 - 删除 AS3 中的父级 : Does this free the memory used by all the children?

Javascript:removeChild 不起作用