When moving one Sprite over another, Top sprite’s image is flickered .Two sprites are in one layer and one is using as background image. I got it working fine in cocos2d+obj-c with following codes, but when i try to convert my codes in to c*+ and use in a cocos2d-x project, top sprite is start to flickers like insane. can anybody pls help me to figure out why this happened? thank you in advance.
cocos2d+obj-c
———————————————
// Determine names of sprite sheets and plists to load
NSString bgSheet = "bg1.pvr.ccz"; NSString *bgPlist =
“bg1.pv.plist”;
/ NSString sSheet = "level1.pvr.ccz"; NSString *sPlist =
“level1.plist”;/
NSString **cmnSheet = "commn.pvr.ccz"; NSString *cmnPlist =
“commn.pv.plist”;
if == UIUserInterfaceIdiomPad) {
bgSheet = "bg1-hd.pvr.ccz"; bgPlist =
“bg1-hd.pv.plist”;
/*sSheet = "level1-hd.pvr.ccz"; sPlist =
“level1-hd.plist”;**/
cmnSheet = "commn-hd.pvr.ccz"; cmnPlist =
“commn-hd.pv.plist”;
}
// Load BG texture
addSpriteFramesWithFile:bgPlist];
// add background for the layer
CCSprite* bgImage = ;
bgImage.position = ccp;
;
// Load Cmn sprites
addSpriteFramesWithFile:cmnPlist];
spriteNodeCmn = ;
;
//add non physics sprites - cloud
cloud = ;
;
cloud.position = ccp;
//move cloud
CCMoveTo * rotLeft = ;
CCRotateTo * rotRight = ;
CCSequence * rotSeq = ;
];
//move bg layer
,
,
,nil]];
————————————————————————————this is working fine in both devices and the simulators—————————————————————-
cocos2d-x* c++
// Load BG texture
CCSpriteFrameCache::sharedSpriteFrameCache()>addSpriteFramesWithFile;>setPosition(ccp(screenSize.width, screenSize.height / 2));
// add background for the layer
CCSprite* bgImage = CCSprite::spriteWithSpriteFrameName;
bgImage
this~~>addChild;
// Load Cmn sprites
CCSpriteFrameCache::sharedSpriteFrameCache~~>addSpriteFramesWithFile;
objectsBatchNode = CCSpriteBatchNode::batchNodeWithFile;
this~~>addChild;
//add non physics sprites~~ cloud
CCSprite **cloud = CCSprite::spriteWithSpriteFrameName;
objectsBatchNode~~>addChild;
cloud~~>setPosition);
//move cloud
CCActionInterval** action1 = CCMoveTo::actionWithDuration(15.0, ccp(screenSize.width * 0.2,screenSize.height * 0.85f));
CCActionInterval* action2 = CCMoveTo::actionWithDuration(15.0, ccp(screenSize.width * 1.8,screenSize.height * 0.85f));
CCActionInterval* seq = (CCActionInterval**));
CCAction** rep1 = CCRepeatForever::actionWithAction(seq);
cloud~~>runAction;
//move bg
this~~>runAction(CCSequence::actions(CCMoveTo::actionWithDuration(3.5f, CCPointMake(–1* screenSize.width, 0.0f)),CCDelayTime::actionWithDuration(1.0f),CCMoveTo::actionWithDuration(3.5f,CCPointZero)));
————————————this result to flickers the cloud sprite in devices with Apple-A5 chip(iPhone4s and iPad2) but worked fine in iPhone4 and the simulator ——————————————————