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. 320x9999 (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 320x480.
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!