Jump to content

Help - - A question about tilemap collide test..


leaf37
 Share

Recommended Posts

Hi friends~!

recently I met with a problem while made a small 2D platform demo..

I use Tiled to make json map file and the there are 3 layers like this:

1.jpg.aede355527d0c3db1812c38cdc86ec00.j

 

and my code are like this :

2.jpg.2ee4a8caec1a74c7e25fbc3f00f4bf82.j3.jpg.c4338b8753403600804a4861fc4ea345.j 

 

 

I don't know why the collide only happened between the ball and the top layer which I draw a red mark in the first pic..

I found this problem because if I paste the layer below to the top .The ball will collide with the new top layer and ignore other layer...

Has someone met this before? - -

 

Link to comment
Share on other sites

setCollisionBetween takes a layer as its fourth parameter. If you don't send it in it defaults to "currentLayer". If you haven't added any layers yet I'm not sure what happens. Try adding the layers first or, better yet, create a separate layer in your map called "collision" and use that but don't draw it.

Also, you don't need to resize the world for each layer: if they're all the same size it's meaningless to do it more than once. If not, just pick one.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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