Cocos2dx制作帧动画

本文介绍如何使用Cocos2d-x中的plist文件和png图片或者pvr.ccz压缩文件来加载资源图。通过具体代码示例展示了两种不同的加载方式,并提供了cocoStudio UI工程的创建方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.使用plist + png方式加载资源图,参数只需要plist路径

cc.SpriteFrameCache:getInstance()::addSpriteFrames("res/yk/china/loading.plist")

2.使用plist + prv.ccz方式加载资源图,参数需要plist路径和ccz的路径

cc.SpriteFrameCache:getInstance()::addSpriteFrames("res/yk/china/loading.plist", "res/yk/china/loading.pvr.ccz");

 

代码举例:

cc.SpriteFrameCache:getInstance()::addSpriteFrames("res/yk/china/loading.plist")
--cc.SpriteFrameCache:getInstance()::addSpriteFrames("res/yk/china/loading.plist", "res/yk/china/loading.pvr.ccz");
local Layer = cc.CSLoader:createNode("res/loading.csb")  --cocoStudio做的UI工程
local Action = cc.CSLoader:createTimeline("res/loading.csb") --序列帧动画
Layer:runAction(Action)
--Action:setTimeSpeed(10/60)
Action:gotoFrameAndPlay(0, true)
xxx:addChild(Layer, 1)

转载于:https://www.cnblogs.com/mingfuqishi/p/7792241.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值