PMayhem

Parallax background with Tileset Image Layer

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.