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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.