Preface:
The role of the first two articles written in just standing blankly,
now will run
when you read this article Your character can run up
As shown below:
We use resources as a sequence of images of a group walk
and then run again achieve these pictures the characters move in a very short time effect
Animation
Animation帧动画对象包含动画帧对象,和帧间时长等等
SpriteFrame Elf frame
每一Animation由很多帧组成,这里我们的就是8个图片 也就是8个SpriteFrame
Each frame interval setDelayPerUnit
帧与帧之间的时间间隔,想让角色跑块一点就设置小一点,想让角色走慢点 就设置大点
setLoops () cycles
如果是1 就是循环一遍 -1就是无限循环 0就是不循环
Animate
Animate can only be executed sprite, while the upper Animation just some resource settings and other information actions, we packed it with Animate
Animation can
CCAnimate* animate = CCAnimate::create(animation);
sprite->runAction(animate);
There are other ways we are not used can not say here
The most simple and easy to understand wording
This is the most simple and easy to understand wording
create eight sprites frame consists of eight pictures
animation add these eight sprites frame
set frame interval and number of cycles
with animate-packaged
let the wizard execution
Concise wording:
The for loop 8 sprite frame into a vector
and directly create animation vector
end:
Write to you we will move the characters also
thank you for praise and attention points