Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6676409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:59:04+00:00 2026-05-26T03:59:04+00:00

I’ve got an issue that I simply can’t figure out; probably because I don’t

  • 0

I’ve got an issue that I simply can’t figure out; probably because I don’t have the correct knowledge.

I have a TMX map made in Tiled. The Map is bigger than the screen size (tiles are 32x32pixels and there are 100×100 tiles).
What I want to do is to be able to move the map by swiping the screen.

I’ve looked at various tutorials online and examined the paddle.m example but still can’t get it to work.
All the tutorials I’ve come across all focus on moving a clamped centered sprite around a map…
Again, what I want to do is to be able to move the map by swiping/sliding the screen; much like when scrolling through your iPod or moving a picture around.

Can anyone help?

Here is my ccTouchMoved code

-(void) ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event
{
    CGPoint touchPointMap = [touch locationInView: [touch view]];
    touchPointMap = [[CCDirector sharedDirector] convertToGL: touchPointMap];
    touchPointMap = [self convertToNodeSpace: touchPointMap];
    CCLOG(@"Touch Point Map %lf, %lf", touchPointMap.x, touchPointMap.y);

    self.position = CGPointMake(touchPointMap.x, touchPointMap.y);
}

To illustrate the problem I’m seeing on screen when I swipe the screen using the code above:
It seems that if I touch the center of the screen, the bottom left corner of the map will jump to that touched coordinate and will move with my touch until my touch is lifted.
The Map’s bottom left corner will always move to where I begin my touch.
Also while the map is being moved, it flashes like crazy and if moved excessively, disappears entirely.

Thanks again All, much appreciated.
Best and Kind Regards,
hiro

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:59:05+00:00Added an answer on May 26, 2026 at 3:59 am

    I found the solution to the problem.
    There’s a very bright person in the Cocos2D community who has written a controller to not only pan around organically, but zoom in and out.

    Link to Controller, example and preview movie

    You wont need to write your touchBegan, Moved and End methods; this Controller does it all for you.

    My init

    self.theMap = [CCTMXTiledMap tiledMapWithTMXFile: @"city_map.tmx"];
            self.bgLayer = [theMap layerNamed:@"bg"];
    
            // boundingRect is the area you wish to pan around
            CGRect boundingRect = CGRectMake(0, 0, 32*50, 16*50);
    
            theMap.anchorPoint = ccp(0,0);
            [self addChild: theMap z: -1];
    
            // _controller is declared in the @interface as an object of CCPanZoomController
            _controller = [[CCPanZoomController controllerWithNode:self] retain];
            _controller.boundingRect = boundingRect;
            _controller.zoomOutLimit = _controller.optimalZoomOutLimit;
            _controller.zoomInLimit = 2.0f;
    
            [_controller enableWithTouchPriority:0 swallowsTouches:YES];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.