天道酬勤,学无止境

ccspritebatchnode

如何在 cocos2d-x 中调整动画精灵的大小(How to resize the the animating sprite in cocos2d-x)

问题 我想更改正在动画的 Sprite 的大小。 我怎样才能做到这一点 ? 我试图通过使用 setScale 属性来改变它的大小,但它在这里不起作用。 我在哪里做错了? CCArray* frames = CCArray::createWithCapacity(3); CCSpriteFrameCache* frameCache = CCSpriteFrameCache::sharedSpriteFrameCache(); char file[100] = {0}; for (int i = 0; i < 3; i++) { sprintf(file, "bird%d.png", i); CCSpriteFrame* frame = frameCache->spriteFrameByName(file); frames->addObject(frame); } CCAnimation* animation = CCAnimation::createWithSpriteFrames(frames, 0.1); CCAnimate* animate = CCAnimate::create(animation); CCRepeatForever* repeat = CCRepeatForever::create(animate); bird->runAction(repeat)

2022-02-14 16:19:57    分类:技术分享    cocos2d-x   ccsprite   ccspritebatchnode   cocos2d-x-2.x

How to resize the the animating sprite in cocos2d-x

I want to change the size of a Sprite which is animating. How can I do this ? I tried to change its size by using setScale property but it is not working here. where I am doing wrong ? CCArray* frames = CCArray::createWithCapacity(3); CCSpriteFrameCache* frameCache = CCSpriteFrameCache::sharedSpriteFrameCache(); char file[100] = {0}; for (int i = 0; i < 3; i++) { sprintf(file, "bird%d.png", i); CCSpriteFrame* frame = frameCache->spriteFrameByName(file); frames->addObject(frame); } CCAnimation* animation = CCAnimation::createWithSpriteFrames(frames, 0.1); CCAnimate* animate = CCAnimate::create

2022-02-14 13:04:02    分类:问答    cocos2d-x   ccsprite   ccspritebatchnode   cocos2d-x-2.x

如何从 GLuint 中检索相应的纹理名称?(How can I retrieve the corresponding texture name from a GLuint?)

问题 编辑 5:优化级别构建设置: 编辑 4:我尝试将构建配置全部更改为“调试”,然后运行以进行“测试”。 奇怪的是,它没有崩溃大约 20 次(我一直加载和卸载具有不同资产的各种 GameScenes)。 在第 21 次(即使没有统计相关性),我正想认为它可能不会再崩溃,但它崩溃了。 摘要仍然不可用,所以我想知道我是否做得对,或者是否存在其他问题..以下是构建配置和崩溃报告: 编辑 3:重要的是,此错误仅发生几次,例如 6/7 次运行中的 1 次,因此我发现很难将其隔离。 我在理解哪个纹理导致此 NSAssert 失败时遇到了一些严重的问题。 我尝试了几种方法,但都没有奏效(或者很可能只是我有点太愚蠢了:))。 在调试器中,我可以看到 GLuint 信息。 在互联网上阅读我发现这是一种引用框架(一种指针)的方法。 我认为应该有一种方法可以从 batchNode plist 文件中检索帧名称,并且想知道这个 GLuint 编号是否可以以某种方式对应于 plist 文件中的帧顺序。 NSAssert( !batchNode_ || texture.name == batchNode_.texture.name , @"CCSprite: Batched sprites should use the same texture as the batchnode"); /** texture

2021-11-18 22:21:27    分类:技术分享    ios   cocos2d-iphone   frame   sprite   ccspritebatchnode

How can I retrieve the corresponding texture name from a GLuint?

EDIT 5: Optimization level build settings: EDIT 4: I tried to change the build configuration putting all to "Debug" and then run for "testing". Weirdly enough it didn't crash for about 20 times (I kept load and unloading various GameScenes whith different assets). At the 21st time (even if not statistically relevant) I was about to think that it might not crash anymore but it crashed. The summary is still unavailable so I am wondering if I am doing it right or if there is some other issue.. Here are the build configuration and the crash report: EDIT 3: Importantly this bug happens only some

2021-11-12 03:41:03    分类:问答    ios   cocos2d-iphone   frame   sprite   ccspritebatchnode

Cocos2dx 2.1.4 游戏,连续 FPS 下降,永不恢复(Cocos2dx 2.1.4 Game, Continuos FPS drop and never recovers)

问题 我正在使用 cocos2dx 2.1.4 创建游戏。 它的 FPS 不断下降,永远无法恢复。 请在下面找到详细信息 关于我做事方式的背景:-它是关于向下滚动一些形状的游戏,每个形状由一些方块组成。我有 7 种方块。 全部加载到一个精灵表中,并使用这个精灵表中的这些块我创建了一个形状。 一个关卡文件由这些形状组成。 我同时加载两个级别,一个在屏幕上,另一个在屏幕外,以使其无缝滚动。 为了同时加载两个关卡,我使用了两个不同的 CCSprite 游戏批处理节点:- CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("56blackglow.plist"); _gameBatchNode1 = CCSpriteBatchNode::create("56blackglow.png", 200); _gameBatchNode1->retain(); this->addChild(_gameBatchNode1,kForeground); _gameBatchNode2= CCSpriteBatchNode::create("56blackglow.png", 200); _gameBatchNode2->retain(); this->addChild(_gameBatchNode2

2021-10-29 10:30:12    分类:技术分享    ios   cocos2d-x   frame-rate   ccspritebatchnode

Cocos2dx 2.1.4 Game, Continuos FPS drop and never recovers

I am creating a game using cocos2dx 2.1.4. Its FPS drops continuously , and never recover. Please find the details as follows Background about the way I am doing things:- Its game about scrolling down some shapes, each shape is made up of some square blocks.I have 7 kind of blocks. All loaded in a Sprite Sheet and using these blocks from this sprite sheet I create a shape. A level file is consist of these shapes. I load two levels at the same time one onscreen and another off screen to make it seamless scrolling. For loading two levels at the same time I used two different CCSprite game batch

2021-10-26 23:03:45    分类:问答    ios   cocos2d-x   frame-rate   ccspritebatchnode