GideonSam Posted January 29, 2018 Share Posted January 29, 2018 (edited) 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 January 29, 2018 by GideonSam Link to comment Share on other sites More sharing options...
Milton Posted January 29, 2018 Share Posted January 29, 2018 Don't use game.height (in the assignment). Make sure you actually stitch them together. So Bg2.y = Bg1.y - Bg2.height. Or something like that. GideonSam 1 Link to comment Share on other sites More sharing options...
GideonSam Posted January 29, 2018 Author Share Posted January 29, 2018 Thanks mate it works fine now Link to comment Share on other sites More sharing options...
Recommended Posts