Jump to content

Question about Tiled + tile images in object layer.


ditikos
 Share

Recommended Posts

Hi,

 

I am trying to layout some tiles in a tiled map and load them into phaser (2.3.0).

I've tried some tilemaps from opengameart which are layed out in columns of 5-6 tiles per row. In this example, the  map.setCollisionBetween(x,y) was not working (I had my main char passing like air), even using game.physics.arcade.collide(player, layer);

 

I then created a simple map of one row with 6 tiles and set map.setCollisionBetween(1,6); and it worked.

 

Now I want to show the Object Layer 1 of tiled. I am using the same tilemap for blocks and objects.

 

I've added the following things in the create() function (after loading the tilesetImage / setCollisionBetween):

 

ladders = game.add.group(); // new sprite group of objects

map.createFromObjects('Object Layer 1',4,'objects',0,true,false,ladders);   // map points to Tilemap objec, ladders is a group

 

// Draw tile layer

layer = map.createLayer('Tile Layer 1');
layer.resizeWorld();

 

Even though it should have been the third tile, it shows the first tile as an object. Is there any example relative to what I am trying to do?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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