plist文件读取并动画

本文档介绍了如何在iOS开发中读取.plist文件,并将其内容用于创建CCAnimation,接着通过GetAnimate方法对CCSprite进行动作操作。同时,提到了在显示FPS时,顶部数值表示待绘制的图元数量。
摘要由CSDN通过智能技术生成

1.读入plist文件

CCSpriteFrameCache *cache=CCSpriteFrameCache::sharedSpriteFrameCache();
cache->addSpriteFramesWithFile("000.pv.plist");
CCSprite *sprite=CCSprite::createWithSpriteFrame(cache->spriteFrameByName("attack_type1_d_0000.png"));

2.形成CCAnimation

//"attack_type1_d_0000.png""attack_type1_d_0001.png""attack_type1_d_0002.png"...
CCAnimation *HelloWorld::GetAnimate(const char *name,const int count,float delay)
//编号为:0~count-1的png图片形成动画(name为共同前缀)
{
	CCArray *a=CCArray::array();
	char keyname[100];
	for(int i=0;i<6;++i)
	{
		sprintf(keyname,"%s%d.png",name,i);
		a->addObject(cache->spriteFrameByName(keyname));
	}
	// 		
	CCAnimation *animation = CCAnimation::animationWithSpriteFrames(a,delay); 
	return animation;
}

3.使用GetAnimate,对一个CCSpri

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值