简体   繁体   English

关于CCSpriteSheet的问题

[英]Question about CCSpriteSheet

I'm using cocos2d to develop game,but i 've got some problems. 我正在使用cocos2d开发游戏,但是我遇到了一些问题。

In game the first time collided with the props would to cause the program slow down,after that the program runs smoothly,but the position of props in screen wouldn't match with the position in my code(such as overlap) 在游戏中,第一次与道具碰撞会导致程序变慢,然后程序运行平稳,但是道具在屏幕上的位置与我的代码中的位置不匹配(例如重叠)

I 've checked the console,it show : 我检查了控制台,它显示:

CCSpriteSheet: resizing TextureAtlas capacity from [1] to [2]. CCSpriteSheet:将TextureAtlas容量从[1]调整为[2]。

I guess that may be the point to cause program slow down,but i did not use the CCSpriteSheet anywhere. 我想这可能是导致程序变慢的关键,但是我没有在任何地方使用CCSpriteSheet。 That confused me a lot.... 这让我很困惑。

Does anyone encountered the same situation?or give me some suggestions? 有人遇到过同样的情况吗?或者给我一些建议?

thanks a lot ~~~ 非常感谢~~~

Only slows down the first time it runs? 仅在第一次运行时放慢速度? I worked around this by running all of my actions or things which happen (in your case this collision) so that they all happened together on a loading screen. 为此,我运行了所有动作或发生的事情(在您的情况下为碰撞),以便将它们一起发生在加载屏幕上,以解决此问题。

This means that all the actions which initially slow down my game are cleared up behind the scenes as it were. 这意味着所有最初使我的游戏变慢的动作都会在后台被清除。

So what I did: When the scene first runs, add a splash loading screen (simply an image hiding your scene) run all your actions while this loading screen can be seen, then once they have al been run reset everything and remove loading screen. 所以我做了什么:当场景首次运行时,添加一个初始加载屏幕(仅是隐藏您的场景的图像)运行所有操作,同时可以看到该加载屏幕,然后一旦运行它们,请重置所有内容并删除加载屏幕。 Its pretty easy. 非常简单。

This way when the player actually plays the game it runs smoothly because the initial loading has already happened. 这样,当玩家实际玩游戏时,由于初始加载已经发生,因此它可以平稳运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM