Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using a tile based game and also used a joystick. Using joystick sprite body move perfectly but tile map can not scroll.

    int x=MAX(position.x*PTM_RATIO, size.width/2);
    int y=MAX(position.y*PTM_RATIO, size.height/2);

    int x1=MIN(x, (theMap.mapSize.width * theMap.tileSize.width-size.width/2));
    int y1=MIN(y, (theMap.mapSize.height * theMap.tileSize.height-size.height/2));

    b2Vec2 goodpoint=b2Vec2(x1,y1);
    NSLog(@"GoodPoint X: %f",goodpoint.x);
    NSLog(@"GoodPoint Y: %f",goodpoint.y);

    b2Vec2 differ=b2Vec2((size.width/2-goodpoint.x),(size.height/2-goodpoint.y));

Is it true logic? Please help me

Thanks in advance

share|improve this question

closed as unclear what you're asking by Vaughan Hilts, Anko, Seth Battin, Sean Middleditch, Jari Komppa Apr 10 '14 at 17:18

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

i guess you should follow your actor in screen, and move screen accordingly..! – Dipen Panchasara May 11 '13 at 6:29