【发布时间】:2013-07-28 09:27:44
【问题描述】:
在我的应用程序中,有一个场景,当用户触摸吃按钮时,我希望我的糖果开始从顶部消失。具体来说,在每次单击按钮时,我想从顶部删除 10% 的糖果图像。 有什么帮助吗?
【问题讨论】:
-
有几种方法:CCClippingNode、CCRenderTexture。详见 cocos2d-x 的测试项目。
-
我找到了这个解决方案,但这是针对 iphone 的。 link。这是我的代码。
CCSpriteBatchNode* cavesheet=CCSpriteBatchNode::create(candy.c_str()); this->addChild(cavesheet); CCSpriteFrame *frame = CCSpriteFrame::createWithTexture(cavesheet->getTexture(),CCRect(0,0,480,heigth*0.9)); FinalScreen::cottoncandy->setDisplayFrame(frame); -
我想要做的是,每次运行这行代码时,我想从顶部删除 10% 的图像并继续缩小它,但奇怪的事情发生了,比如位置发生了变化,我不知道还有什么。有什么想法吗?
标签: android image sprite cocos2d-x