How to make a sprite jump like a frog in cocos2d-x ios game using c++

How to make a sprite jump like a frog in cocos2d-x ios game using c++
0.0 0


I am trying to make a sprite as a frog which will come from the top of the screen and will go downwards to the bottom at y axis =0.Its working fine as a normal CCMoveTo but i want that after a jump the frog should rest for 1 second then again jump.Some kind of delay in moving.Can anyone tell me with this.I am attaching my code also. my frog animations are from fly1.png to fly5.png.I just want a delay after each move or we can say that I just want to call the CCMove after 1 second delay each time until the frog reaches the y axis=0 Any help will be appreciated.Thanks

#include "HelloWorldScene.h"
#include "SimpleAudioEngine.h"
using namespace cocos2d;
using namespace CocosDenshion;

CCScene* HelloWorld::scene()

CCScene *scene = CCScene::create();

HelloWorld *layer = HelloWorld::create();


return scene;

bool HelloWorld::init()

if ( !CCLayer::init() )
    return false;
CCSize winSize=CCDirector::sharedDirector()->getWinSize();

_bgNode = CCNode::create();
_bgNode->setPosition(ccp(winSize.width/2, winSize.height/2));
this->addChild(_bgNode, -1);

_bgSprite = CCSprite::create("bg_2.jpg");

float rX = winSize.width/_bgSprite->getContentSize().width;
float rY = winSize.height/_bgSprite->getContentSize().height;


CCAction *a=CCRepeatForever::create(HelloWorld::getAnimationWithFrames(1,5));

z->runAction(CCSequence::create(CCMoveTo::create(2.0, ccp(winSize.width/2, 0)), CCCallFuncN::create(this, callfuncN_selector(HelloWorld::setInvisible)), NULL));

return true;

cocos2d::CCAnimate* HelloWorld::getAnimationWithFrames(int from, int to)
CCArray* frames = CCArray::create();

for (int i = from; i <= to; i++)
    CCString *str = CCString::createWithFormat("fly2%d.png", i);
    CCSpriteFrame *f = CCSpriteFrame::create(str->getCString(), CCRect(0,0,256,400));
CCAnimation *animation = CCAnimation::createWithSpriteFrames(frames,0.15f);

CCAnimate *a = CCAnimate::create(animation);
return a;

void HelloWorld::setInvisible()


and i have used CCJumpTo also.But my main problem is that with each jump I want a pause of 1 second


use CCDelay


but how to use and where to use.can you elaborate and give a snippet


you can create a action like…
CCActionInterval *frogJump= CCJumpBy::create(.5f,ccp(JUMP_DISTANCE,0),JUMP_HEIGHT,1); // you can replace 1 by number of jumps you want.
<-- then create a object of CCSequence as follows–>

CCFiniteTimeAction* jumpSeq = CCSequence::create(frogJump, CCDelay::create(1),frogJump, NULL);

Above code will make your frog jump twice with a delay of 1 sec;
FOR EXTRA INFO: you should refer test.cpp samples