使用缩放帧的精灵表动画
Spritesheet animation with scaled frames
为了在cocos2d-x 3.2中创建动画,我这样做:
SpriteFrameCache* cache = SpriteFrameCache::getInstance();
Vector<SpriteFrame*> animFrames(15);
for(int i = 1; i <= 7; ++i)
{
SpriteFrame* frame = cache->getSpriteFrameByName(String::createWithFormat("%d.png", i)->getCString());
animFrames.pushBack(frame);
}
auto animation = Animation::createWithSpriteFrames(animFrames, 1 / animFrames.size());
auto animate = Animate::create(animation);
pSprite->runAction(animate);
但现在我需要一些帧来用-1缩放ByX,以便创建镜像。SpriteFrame
没有scale
方法。此外,我不能scale
和pSprite
,因为只有一些帧应该缩放。我该如何解决这个问题?
您遇到了一个非常奇怪的情况:)
-
您可以在sprite上安排更新选择器,并根据所需条件将flipX设置为true/false这是我个人的喜好
-
你不能用这种方式破解SpriteFrame,但你可以使用RenderTexture:http://www.cocos2d-x.org/reference/native-cpp/V3.0alpha0/d9/ddc/classcocos2d_1_1_render_texture.html-在一个新的纹理中翻转你想要的精灵,基本上是动态生成一个新精灵表现在这是个坏主意
相关文章:
- 在执行其他功能的同时播放动画(LED矩阵和Arduino/ESP8266)
- 使用 GLUT 使用键停止动画?
- 使用对象数组对 SFML 进行动画处理
- 从精灵表在 sfml 中为精灵制作动画
- 精灵动画查看器应该使用哪些Qt小部件
- 精灵没有动画
- 我没有看到精灵的动画
- Cocos2d中精灵的暂停/简历动作/动画
- 精灵表动画 ->滞后?
- 使用OpenGL的2D精灵动画技术
- 在 Cocos2DX 中移动动画精灵和路径
- 使用缩放帧的精灵表动画
- 精灵表动画Cocos2dx
- SDL2 c++捕捉渲染动画/精灵的视频
- 在Cocos2dx中协调多个精灵动画
- SDL动画精灵
- 如何传递一个c++对象变量到Lua脚本,以便动画精灵
- SDL如何在按键时设置精灵的动画
- 如何在 OpenGL 中高效地制作 2D 精灵动画
- 我如何设置一个if语句来动画一个精灵