Jump to content

Parallax background with Tileset Image Layer


PMayhem
 Share

Recommended Posts

Is this at all possible?

 

I originally managed to achieve the effect when I loaded in the background as one single image.

 

But now I'm using tilemaps and adding to a layer with addTilesetImage I can't seem to get any movement there.

 

It's just a simple 

 

x -= 0.5; //When moving right

x += 0.5; //When moving left

 

 

Here's how I'm currently loading the background layer:

game.load.image('sky', 'assets/parallax-bg.png');

game.load.tilemap('map', 'assets/tilemaps/level1.json', null, Phaser.Tilemap.TILED_JSON);

this.map = this.add.tilemap('map');

this.map.addTilesetImage('background_spritesheet', 'sky');
bgtile = this.map.createLayer('backgroundLayer');

 

 

Then I've tried the following in the update() within my if(cursors.left.isDown) to try and get some movement
bgtile.tilePosition.x += 0.5;

 

Oh, and here's a link of the WIP if anyone's interested!
http://projectmayhem.co.uk/sandbox/santa/santa.html

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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