How to create animation when animal moving

I want to create a animation when an animal is moving ( a bird flapping wing when it is moving). I have 16 pic to create animation.

I try below. But only a animal is moving by cc.MoveTo. Someone can help me please.

    var sprite = cc.Sprite.createWithSpriteFrameName('Home/vit xiem_00001.png');
    sprite.setPosition(cc.p(-285, 400));
    this.rootNode.addChild(sprite);
    //sprite.setZOrsder(100);

    var actionTo = cc.MoveTo.create(4, cc.p(800, 400));

    sprite.runAction(actionTo);

    var animation = cc.Animation.create();
    for( var i = 1; i <= 16; i++) {
        var frameName = 'Home/vit xiem_0000' + i + '.png';
        animation.addSpriteFrame(cc.SpriteFrameCache.getInstance().getSpriteFrame(frameName));
    }


    animation.setDelayPerUnit(0.1);

    var action = cc.RepeatForever.create(cc.Animation.create(animation));

Hi,
remove

sprite.runAction(actionTo);

and

var action = cc.RepeatForever.create(cc.Animation.create(animation));

replace with

sprite.runAction(cc.RepeatForever.create(cc.Spawn.create(cc.Animation.create(animation), actionTo)));

Spawn is an action to run more than one actions in the same time.
I hope it will help you.

I try but I get a bug: “Object # has no method ‘startWithTarget’”. How can I fix it?
Tobias S wrote:

Hi,
remove
[…]
and
[…]
replace with
[…]
>
Spawn is an action to run more than one actions in the same time.
I hope it will help you.

Some one help me, please :frowning:

If you’d like help putting your project together, check out suiteimagery.com and email me at steve@suiteimagery.com. I’d be happy to help.