Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question
    
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) –  dqhendricks Dec 28 '12 at 0:45

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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