Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 495771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:37:22+00:00 2026-05-13T05:37:22+00:00

I need make active background which consists of 2 CCSprites which moves successive. But

  • 0

I need make active background which consists of 2 CCSprites which moves successive. But at the same time between CCSprites appear a little interval. How fix it?

Some init code:

    sprite1 = [sprites objectAtIndex:0];
    [sprite2 setPosition:ccp(240.0,self.position.y)];
    sprite2 = [sprites objectAtIndex:1];
    [sprite2 setPosition:ccp(720.0,self.position.y)];
    [self addChild:sprite1 z:0];
    [self addChild:sprite2 z:1];
    [self schedule:@selector(update) interval:1/60.0];

This is the code, which move sprites:

-(void)update{
if (sprite1.position.x<=-239.0) {
    [sprite1 setPosition:ccp(720.0,self.position.y)];
    flag = false;
}else{
    if (sprite2.position.x<=-239.0) {
        [sprite2 setPosition:ccp(720.0,self.position.y)];
        flag = true;
    }
}

if (sprite1.position.x<=720.0) {
    if (flag) {
        [sprite1 setPosition:ccp(sprite1.position.x-speed, self.position.y)];
        [sprite2 setPosition:ccp(sprite1.position.x+480, self.position.y)];

    }else {
        [sprite2 setPosition:ccp(sprite2.position.x-speed, self.position.y)];
        [sprite1 setPosition:ccp(sprite2.position.x+480, self.position.y)];
    }

}

}

Interval : image

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T05:37:23+00:00Added an answer on May 13, 2026 at 5:37 am

    If the gap is just one pixel, it’s likely this is just the way OpenGL/Cocos2D behaves.

    Instead of making your images 480×320, make them 482×320, and make them overlap with those extra pixels. Then the gap will be gone.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to make a point in time branch, when we release a new
I'm trying to make changing background image by menu item. It's works now but
I have an IPad apllication in which I need to make a number pad
I am trying to use forms authentication with Active Directory but I need roles
I am trying to remove li's with not active state, but cant make it
I need to make a Active directory search, for example I have the follow
My project in some part need GPU acceleration to make a fast translation, but
I need to make tabbar of the following desigh: Its active item overlaps adjacent
I need make some action (dump statistical data) before the Dart program ends. The
I need make all of my posts update. I use bulk upload for store,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.