Jump to content

Using an Atlas with Tilemap


c-andrews
 Share

Recommended Posts

Hi,

 

I've just started using Phaser and its great. Theres lots of tutorials and lots of answered questions. But now i've hit a bit of a wall.

 

I would like to try and use an Atlas with a TileMap (built using Tiled) and cant seem to find any information on it. I am using an atlas because my graphical assets are all different sizes, well apart from the floor tiles. 

 

Here some code:

preload : function () {	this.load.tilemap( "level", "assets/tilemaps/level.json", null, Phaser.Tilemap.TILED_JSON );	this.load.atlas( "scenery", "assets/sprites/scenery.png", "assets/sprites/scenery.json" );}create : function() {		this._map = this.game.add.tilemap( 'level' );		//this._map.addTilesetImage( 'ground', 'ground-tiles' );	this._backgroundLayer = this._map.createLayer( "ground" );	this._backgroundLayer.resizeWorld();} 

This is just using one image with the key "ground-tiles". But now my map need collidables and trees etc.

 

Can anyone tell me how or if i can use an Atlas with my Tilemap?

 

Thanks

 

Link to comment
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...
 Share

  • Recently Browsing   0 members

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