iOS 플랫폼 용 간단한 게임을 만들기 위해 C++와 함께 cocos2dx v3.11.1을 사용하고 있습니다. 하지만 스프라이트 움직임에 이상한 문제가 있습니다. 주 객체의cocos2d - 스프라이트가 올바르게 표시되지 않습니다.
정의는 다음과 같습니다
이Sprite *logoBackSprite;
SpriteFrameCache *cache;
SpriteBatchNode *batchNode;
나는 그 같은 PLIST에서 스프라이트를 만들 : 스프라이트에 대한 간단한 움직이는 애니메이션을 수행해야하는 I 통화 기능 후
cache = SpriteFrameCache::getInstance();
cache->addSpriteFramesWithFile("game_sprites1.plist");
batchNode = SpriteBatchNode::create("game_sprites1.png");
addChild(batchNode);
logoBackSprite = Sprite::createWithSpriteFrameName(fileName);
logoBackSprite->setPosition(Vec2(centerPoint.x-4, centerPoint.y + 200-43));
addChild(logoBackSprite, 0);
. 이 함수의 코드는 다음과 같습니다.
void MainMenuScene::playMenuAnimations() {
float startDelay = 0.0f;
auto windowSize = Director::getInstance()->getVisibleSize();
Point centerPoint = Vec2(windowSize.width/2, windowSize.height/2);
logoBackSprite->stopAllActions();
logoBackSprite->setOpacity(0);
logoBackSprite->runAction(Sequence::create(DelayTime::create(startDelay + 0.5 + 0.75),
FadeTo::create(0.5f, 255),
nullptr));
}
그러나 애플리케이션을 실행할 때 아무런 반응이 없습니다. 내가 잘못하고있는 것을 지적 해 주시겠습니까? 고맙습니다.
EDIT 몇 시간 동안의 실험 끝에 스프라이트 개체의 runAction 메서드가 작동하지 않는다는 것을 알았습니다. 예를 들어, 스프라이트 프레임의 벡터를 만들고 애니메이션을 실행하고 싶습니다. 응용 프로그램을 실행하면이 스프라이트를 볼 수 있지만 애니메이션은 여전히 작동하지 않습니다. 어쩌면 나는 중요한 것을 놓친 것일까?
EDIT2 오늘 나는 모든 장면이 이전 장면에서 효과가 있다는 것을 알아 챘습니다.