Jump to content

Parallax Background


Ansimuz
 Share

Recommended Posts

In phaser 2 to simulate parallax background when the camera moved  I used:

 

 background.tilePosition.x = this.layer.x * -0.2;

 

Heres the complete logic in Phaser 2

// create
globalMap = game.add.tilemap("map");
globalMap.addTilesetImage("tileset");
this.layer = globalMap.createLayer("Tile Layer 1");
this.layer.resizeWorld();

background = game.add.tileSprite(0,0, gameWidth, gameHeight, "background");
background.fixedToCamera = true;

// update
 background.tilePosition.x = this.layer.x * -0.2;

 

 

How would be the best way to do it in Phaser 3?

 

parallax_bg.tilePositionX = ?

 

 

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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