I have a vertical shooter, the game scrolls TMXTiledMap, and when it runs out I want it to load next map and scroll them seamlessly without interruption. How do I achieve that?

Here is my scrolling method, if I load another map it stops, I need to add scrolling to another map, is there a way around that?

- (void) update: (ccTime) delta

    CGPoint tempPos = myMap.position;
    tempPos.y -= 2;
    myMap.position = tempPos;

How do I load next map so they are scrolling seamlessly and connected to each other?

  • \$\begingroup\$ oy. you may want to consider using delta in your changing of the position, otherwise the slower your framerate, the slower your background will move. Typically people do something like tempPos.y -= (velocity * delta) \$\endgroup\$ – dqhendricks Dec 28 '12 at 0:45

you will need two variables, one for oldmap and one for newmap. you will scroll them both. when newmap's right side reaches the right edge of the screen, you will create a another map and add it at screen width (for its y). You will then move newmap into the oldmap, and place the newly created map into newmap. once oldmap's right side has reached the screen's left side, you will remove it all together. The cycle repeats.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.