nak3ddogs Posted July 1, 2014 Share Posted July 1, 2014 helo. pls someone help me. i wanna place a bg to my screen with auto scrilling infinitely. i tryed this code game.bg = this.game.add.tileSprite(0,0,800,480,'background'); game.bg.autoScroll(-100,0); and it looks like fine for the first 800 pixel but not inifinite for the whole gameafter i tried to add this code for this game.bg.fixedToCamera = true; and now i have the bg for the whole game and it is autoscrolling but when i move with my hero the bg scrolling is not scrolling well relatively to my vision. sry for my terrible english and thx for any advice! Link to comment Share on other sites More sharing options...
j0hnskot Posted July 2, 2014 Share Posted July 2, 2014 You could scroll the background with the same velocity character uses to move. It's really up to you to decide how fast or slow an element will move in your game. Link to comment Share on other sites More sharing options...
Starboar Posted July 2, 2014 Share Posted July 2, 2014 You probably want to manually scroll the tile in this case, so still use a tileSprite but in an update() function do this: game.bg.tilePosition.x = yourGameWorld.x ; game.bg.tilePosition.y = yourGameWorld.y ;where "yourGameWorld" is whatever you are using as a frame of reference. I'm don't think "fixedToCamera" is needed. I'm assuming your character never moves on the screen, but the background does. If that's the case then the camera isn't moving. nak3ddogs 1 Link to comment Share on other sites More sharing options...
Recommended Posts