Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Loading new background each time? I strongly suspect flickering is caused by loading time in texture. You can use threaded loading to avoid flickering.</p> <p><a href="https://stackoverflow.com/questions/12345556/cocos2d-continuously-scrolling-tile-based-game-strange-flash-only-in-device">Here is once other question with something similar problem.</a></p> <p><a href="https://stackoverflow.com/questions/14932027/continuous-scrolling-of-background-in-cocos2d/14932464#14932464">Continuous-horizontal-scrolling-of-background-in-cocos2d</a>: Refer my answer</p> <p>Continuous vertical scroll:</p> <pre><code> #define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) #define MM_BG_SPEED_DUR ( IS_IPAD ? (6.0f) : (2.0f) ) -(void)onEnter { [super onEnter]; [self initBackground]; [self schedule: @selector(tick:)]; } -(void)initBackground { NSString *tex = @"BG/Background.png";//[self getThemeBG]; mBG1 = [CCSprite spriteWithFile:tex]; mBG1.position = ccp(s.width*0.5f,s.height*0.5f); [self addChild:mBG1 z:LAYER_BACKGROUND]; mBG2 = [CCSprite spriteWithFile:tex]; mBG2.position = ccp(s.width*0.5f,s.height*0.5f+mBG1.contentSize.Height); mBG2.flipY = true; [self addChild:mBG2 z:LAYER_BACKGROUND]; } -(void)scrollBackground:(ccTime)dt { CGSize s = [[CCDirector sharedDirector] winSize]; CGPoint pos1 = mBG1.position; CGPoint pos2 = mBG2.position; pos1.y -= MM_BG_SPEED_DUR; pos2.y -= MM_BG_SPEED_DUR; if(pos1.y &lt;=-(s.height*0.5f) ) { pos1.y = pos2.y + mBG2.contentSize.height; } if(pos2.y &lt;=-(s.height*0.5f) ) { pos2.y = pos1.y + mBG1.contentSize.height; } mBG1.position = pos1; mBG2.position = pos2; } -(void)tick:(ccTime)dt { [self scrollBackground:dt]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload