How to resolve this question

When I use the following code, I can see the “node2” sprite after running the program.

	node2 = Sprite::create("ty.png");
	node2->setPosition(Vec2(700, 600));
	this->addChild(node2,5);
	auto listener = EventListenerKeyboard::create();
	listener->onKeyPressed = [=](cocos2d::EventKeyboard::KeyCode keyCode, Event* event) {
		keys[keyCode] = true;
	};
	listener->onKeyReleased = [=](cocos2d::EventKeyboard::KeyCode keyCode, Event* event) {
		keys[keyCode] = false;
	};
	_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
	this->scheduleUpdate();

But when I add the following code. I can’t see the “node2” sprite after running the program.

	auto s = Director::getInstance()->getWinSize();
	auto pFollow = Follow::create(node2, Rect(0, 0, s.width + 3840, s.height)); 
	node2->runAction(pFollow);

Why?

In order to facilitate debugging, I modified the following code, and output the screen coordinate value of node2 twice in the code. The code is as follows:

	node2 = Sprite::create("ty.png");
	node2->setPosition(Vec2(700, 700));
	this->addChild(node2,5);
	Vec2 b = this->node2->getPosition();
	CCLOG_VEC2(b);
	auto listener = EventListenerKeyboard::create();
	listener->onKeyPressed = [=](cocos2d::EventKeyboard::KeyCode keyCode, Event* event) {
		keys[keyCode] = true;
	};
	listener->onKeyReleased = [=](cocos2d::EventKeyboard::KeyCode keyCode, Event* event) {
		keys[keyCode] = false;
	};
	_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
	this->scheduleUpdate();
	
	auto s = Director::getInstance()->getWinSize();
	auto pFollow = Follow::create(node2, Rect(0, 0, s.width + 3840, s.height)); //3840是整个场景的宽
	node2->runAction(pFollow);
	Vec2 a = this->node2->getPosition();
	CCLOG_VEC2(a);

After executing the ‘Follow’ animation,
The output value of the variable ‘b’ and the variable ‘a’ is the same, that is to say, regardless of whether the ‘Follow’ animation is executed or not, the coordinates output by the node2 node are the same, and they are all on the screen.

In this case,
If the ‘Follow’ animation is not added, the node2 node can be seen. After adding the ‘Follow’ animation, why can’t the node2 node be seen after the program runs?

I’m not sure what you mean by “follow animation”, but the follow action you’ve created appears to be incorrect, since you’re making node2 follow itself.

The cpp-tests project has a number of examples of correct usage.

Try changing this:
node2->runAction(pFollow);
to this
this->runAction(pFollow);

Please choose a better title!

after modified like this:

this->runAction(pFollow);

It is ok now,thanks.
I have a another question,please look at here:
https://discuss.cocos2d-x.org/t/is-it-possible-to-perform-a-sequence-frame-animation-without-adding-every-frame/57230/2