Seamless Map Scrolling?

0 favourites
  • 6 posts
From the Asset Store
Seamless cartoon vector landscape design set. Ground floor collection for game interface.
  • I want to create a seamless map scrolling system, for level selecting in a game.

    Here is an example of a seamless map:

    What I want to accomplish is the following:

    User swipes the map in any direction, the viewport scrolls in that direction using Scroll To

    The map/viewport should wrap, giving the impression that the map wraps around, it should be smooth, not just snap to the opposite side

    There will be icons on the map, which will be clickable.

    Here is a CAPX, with the map texture and a few buttons on the map, you can click and drag the map.

    Anyone know how to do this?


  • I did it for one of my projects here

    The maths for plotting object movements along it is a little complicated but if you just want to scroll a map then simply create say 2 copies of the image for the x axis and 2 for the y axis and when you reach the edge of one reposition the opposite edge of another copy at that position.

    The map needs to be bigger than the window, and for performance you may need to break the large image into smaller sections.

    If the map is smaller than your window size then you'll need to use more copies.

  • For scrolling:

    Make one 16x16 object and stretch that to fit the screensize. Break the high resolution map up in smaller pieces and 'pin' those to the 16x16 object. Make the 16x16 object draggable. This way you only have to animate one object and have a map that can be higher than 2000x2000 pixels.

    For zooming:

    Now make a global variable named "Zoom' which has a default of 1 and set the layer scale to match this variable. On mousewheel-up add 0.2 to the variable 'Zoom' and on mousewheel-down subtract 0.2. On every tick set layer scale to 'Zoom'. If Zoom < 1 Zoom = 1.

    I hope this helps. I cannot open your file for i am using the last stable version and you hve a newer version of C2.

  • UberDark, thanks, the problem isnt the scrolling, its the seamless scrolling. To be more clear, if the user gets to the far right side off the map, they should start seeing the far left side of the map again, almost like place the maps next to each other.

    But, I was able to solve this. Made the map into tiles, when a map tile is off screen, it moves itself to the other side, depending on which way the user is scrolling. The map icons are pinned to the tiles

  • I see! Cool glad you figured it out. Sorry i didn't understand.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Here is the capx, if anyone wants to do something similar


Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)