I have game application (cocos2d) in which, a ball is to be shooted from a cannon, this ball travels through a trajectory path and land on a building. Now the problem is that according to the requirement I have to increase the size of the background image due to which my building image is not visible on first view and with the ball traveling i have to drag the background image with out disturbing the trajectory path of the ball. Can some one help me out in this regards. To clarify question bit more I am also attaching a image. Thanks in advance.
Share
what you have are two different coordinate spaces that should be independent from each other.
The ball should move in the “world” coordinate space, independently from the “screen” coordinate space. Of course that the “world” must be displayed on the “screen”, so you must convert the “world” coordinate space to “screen” coordinate space, which in you case is a simple translation that can be done by adding an offset.
On iPhone, you can simply put all the “world objects” inside a
UIViewand move that ‘UIView’ left and right, while the world objects move relatively to the “world” inside that view, and the conversion from “world coordinate space” (the view coordinate space) to the screen coordinate space will be done for you when the view is drawn on screen.