Jump to content

Using several Tiled map on huge world


Shyt3000
 Share

Recommended Posts

Hi, I want to create a big world.  I load a few tylemaps. All cards I initialize with

 

layer.scrollFactorX = 0;
layer.scrollFactorY = 0;
layer.position.set(m.startX, m.startY);

When I move my camera to the tilemap from the left (game.camera.x >= layer.x) i want to stick the map to the camera (layer.x = 0;) and move its contents, but when I do -

layer.scrollFactorY = 1;

the card "jumps" to the distance the camera passed before it ( video in attach), haw can i fix that? 

 

And how i can scroll map to left side? (if i will move camera from right side)

Без названия.mov

Link to comment
Share on other sites

10 hours ago, Shyt3000 said:

the card "jumps" to the distance the camera passed before it ( video in attach), haw can i fix that?

It has to jump because the scroll position has to be accurate during each frame.

You should tween scrollFactorY from 0 to 1 for a gradual change.

Link to comment
Share on other sites

Thanks for the answer but my problem is not in the smoothness of the jump.

I need, that would be when the camera went to the border tilemap - the map began to spin from zero X position. Now she starts from the position where I installed the map.

Tryed this: 

layer.scrollX = 0;

But  it don't have any effect =(

Any ideas haw i can scroll tilemap?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...