Jump to content

TileSprite Alternative


GideonSam
 Share

Recommended Posts

Hi All,

I have been working on a Endless Runner game for mobile and web .

Initially i Used TileSprite for the looping background,but it affects the performance on mobile.

Then i used the classic method of moving two backgrounds simultaneously.

But if i increase the speed of the movement , it gives a gap between two backgrounds.

Kindly help me with the logic

bgSpeed = 10

update()
{
  mainBg1.y += bgSpeed; 
  mainBg2.y += bgSpeed;   

  if(mainBg1.y >= this.game.height)
  {
    mainBg1.y = -this.game.height;
  }
  if(mainBg2.y >= this.game.height)
  {
   mainBg2.y = -this.game.height;
  }

}

 

Edited by GideonSam
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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