Removing MANY CCSprites

隐身守侯 提交于 2019-12-13 21:09:18

问题


Hey guys and girls. I have a method that creates rain particles, tiny images, of CCSprite class type. Everything is working well, when the clouds rain, they rain many particles of CCSprites until they leave the vertical winsize space.. Once they do leave the vertical winsize space, the iphone simulator begins to lag as it removes each rain CCSprite.

I think the problem is that their are so many CCsprites to remove, not the actual demand of having them in the memory.

My method to remove sprites is called 60 times per second. I tried perhaps changing the frequency of deletion to 1/1second, but to no avail, its made it more laggy because theres more sprites to delete at once...

How could I go about fixing this problem, or am i using CCsprite ineffectively, is there a better Class to use?


回答1:


There is a particle example.. which is rain particle..

call the function 30 times per second.. i am not sure why removing would lag..




回答2:


To simulate rain take a look at particle effects in cocos2d (there is a rain example). It should be more effective and much more easy to create and use.



来源:https://stackoverflow.com/questions/5074999/removing-many-ccsprites

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!