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 5845055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:22:49+00:00 2026-05-22T12:22:49+00:00

Hey guys, I have a raidan style 2d flying/fighter game that im working on.

  • 0

Hey guys,
I have a raidan style 2d flying/fighter game that im working on.
Upon moving it from the standard NSObject framework to Cocos2D, I have encountered an issue with my background image/sprite.

Before cocos2d, my background was very large vertically. 320×9999 (or something). But it loaded and it created the illusion for a very large level.
Cocos2d has limitations on its image sizes, so I was forced to slice up the image into 33 different background images each at 320×480.

Understanding that memory is a big deal on the iOS platform, I decided that I would create 2 background CCSprites:
CCSprite *background1, *background2;
Background2 ontop of background1.

Using these two backgrounds, as the Jet moves up the screen, each background will move inversely down the screen at an equal rate, As the first background1 moves completely off the screen vertically, it is released back into the memory and a new sprite is loaded into background1 and background1 is then positioned above background2 vertically.

As background2 moves off the screen, it is released and a new image is loaded into background2 and it is placed ontop of background1.

Creating the illusion of a constant and consistent background.

Q. Does this seem like a valid method?
Q. How could I go about achieving something like this programatically? I have the physics of movement and everything ready to go. Im just a little unsure how to do this with Cocos.

Once again, thanks in advance!

  • 1 1 Answer
  • 5 Views
  • 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-22T12:22:50+00:00Added an answer on May 22, 2026 at 12:22 pm

    A1) yes it’s a valid way to do so, and it’s almost very easy thing to do ht ecode goes somthing like this (i may have some programatical errors ,consider this almost as a psudo code!):

    if(background[1].position.y < 0)
    {
        [layer removeChild:background[1] cleanup:YES];
        background[1] = background [2];
        background[2] = [CCSprite SpriteWithFile:"file id"]
        background[2].position = ccp(0,480);
        [background[2] runAction:[CCMoveBy actionWithDuration:1 position:ccp(0,1)]]
    }
    

    A2) if you only needed some guide to do so i gave you an implementation for what you need and if you mean you don’t know how to implement plysics stuff using cocos2d-iphone try these manuals :

    http://www.raywenderlich.com/457/intro-to-box2d-with-cocos2d-tutorial-bouncing-balls

    http://www.raywenderlich.com/475/how-to-create-a-simple-breakout-game-with-box2d-and-cocos2d-tutorial-part-12

    http://www.raywenderlich.com/505/how-to-create-a-simple-breakout-game-with-box2d-and-cocos2d-tutorial-part-22

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

Sidebar

Related Questions

Hey guys I have an ajax jquery function that receives data from a php
Hey guys I have a list menu that's created from a strings column of
Hey guys I have an admin page that checks if you are admin before
Hey guys I have one more question lol. I am using a script that
Hey guys I have an assigned array from mysql results and I simply want
Hey guys I have a query that currently finds the latest comment for each
Hey guys I have an array of dictionaries plist file that I am reading
Hey guys I have a query that selects data and organizes but not in
Hey guys I have a quick question, I have a dialog box that has
Hey guys i have a ListActivity... a very simple at that... and it keeps

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.