Search code examples
cocos2d-iphonecocos2d-x

How can follow the Hero with endless?


I want to follow the Hero with endless. I have using the following code with limit. It is limited area to follow the Hero.

Here is the coding:

 CCSize size = CCDirector::sharedDirector()->getWinSize();
 CCRect rect = CCRectMake(0, 0, size.width, size.height);
 this->runAction(CCFollow::create(playerSprite, rect));

My game logic - Hero is moving continuously with no boundary.

How can hero follow the object with endless?

Any idea should help me a lot. Thanks in advance.


Solution

  • Try this..

     this->runAction(CCFollow::create(playerSprite));