I have a strange issue with RepeatForever at the moment; it’s not repeating the sequence at all. Repeat works fine (if I use X number of repeats), but RepeatForever doesn’t repeat a sequence, but simply stops at the end of the entire sequence. The code is exactly as follows:
Size visibleSize = Director::getInstance()->getVisibleSize();
meterSprite = Sprite::createWithSpriteFrameName("meter.png");
auto meterSize = meterSprite->getContentSize();
auto meterClippingNode = ClippingNode::create();
meterClippingNode->setPosition(Vec2(visibleSize.width / 2, visibleSize.height / 2));
cocos2d::DrawNode *stencil = DrawNode::create();
stencil->drawSolidRect(Vec2(0, 0), Vec2(meterSize.width, meterSize.height), Color4F::MAGENTA);
auto moveBy = MoveBy::create(2, Vec2(0, -meterSize.height));
auto seq = Sequence::create(moveBy, moveBy->reverse(), nullptr);
auto rfe = RepeatForever::create(seq); // Problem: Does not repeat the sequence
// auto repeat = Repeat::create(seq, 10); // This works fine (repeats 10 times)
Is there something I’m doing wrong?
By the way, what this code does is move a stencil within a clipping area, with a sprite behind the stencil, so the sprite appears and disappears as the stencil moves down then up (and should repeat!).