Jump to content

Moving straight background tileSprite


sinanqd10
 Share

Recommended Posts

preload: function() {
    this.game.load.image('road', 'assets/images/road.png');
},

create: function() {
    this.game.world.setBounds(0, 0, 1136, 640);
    this.road = this.game.add.tileSprite(this.game.world.centerX, this.game.world.centerY,    this.game.width, this.game.height, 'tileRoad');
    this.road.anchor.setTo(0.5);
},

update: function() {
   this.road.tilePosition.y +=1;
}

this code is for tilling the background from top to bottom. However, I would like to tilling the background straight to the camera view. what technique I need to use for achieving it?
here is the example of the tilling background I have found in this game http://www.nickjr.com/paw-patrol/games/paw-pups-save-the-day/.

Can anyone give me a clue to do so? Thanks!

tile-road.png

Link to comment
Share on other sites

6 minutes ago, sinanqd10 said:

@symof

I have found these articles, but I really don't understand the flow @@. Could you please simplify?

I actually can't. That article explains it much better and more detailed then I could.

It should be a sufficient starting point for you to know what you need. If you're expecting a cheese way of doing it, i'm sorry to say you won't find it, as programming complex code still requires math.

http://www.extentofthejam.com/pseudo/

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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