更新时间:2023-12-01 16:05:04
更新方法是可以做到的:
Update method is where you can do it alright:
- (void)update:(NSTimeInterval)currentTime {
//remove any nodes named "yourNode" that make it off screen
[self enumerateChildNodesWithName:@"yourNode" usingBlock:^(SKNode *node, BOOL *stop) {
if (node.position.x < 0){
[node removeFromParent];
}
}];
}
请注意,删除节点并不能保证释放内存!!
Though note that removing nodes doesn't guarantee freeing up memory!!