Sign in to follow this  
Ansimuz

Parallax Background

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 = ?

 

 

 

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.