Jump to content

continuous and smooth world scroll


sombriks
 Share

Recommended Posts

Hello all,

 

currently i'm using a trick to make my game look endless: while i keep moving the camera and the player, i test if the end of the world is near; if yes, my camera will stop to slide soon. Then, i simply change the x coordinate value to 0.

 

Doing the correct math and the correct scenario, the jump will look quite good. But it's not enough. For example, if some item where present in the last portion of the world, it certainly won't be at the begining. It leads to make sure that certain items will use the very same spritre, and so on.

 

Is there any other way to get the endless effect? any effective way to create the illusion?

 

Any idea is welcome. 

Link to comment
Share on other sites

 

You can create a background that's moving and repeating itself forever using Tile Sprites and the autoScroll method:

var background = this.add.tileSprite(0, 0, this.game.world.width, this.game.world.height, 'background');background.autoScroll(this.levelSpeed, 0);

 

Thanks a lot for the answer.

 

Due to other reasons i ended up doing 3 groups for the scenario and playing with their x coordinates and shuffing sprites inside them everytime they come offscreen.

 

I'll use autoScroll approach next project

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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