leaf37 Posted January 12, 2016 Share Posted January 12, 2016 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: and my code are like this : 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 More sharing options...
drhayes Posted January 12, 2016 Share Posted January 12, 2016 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. leaf37 1 Link to comment Share on other sites More sharing options...
leaf37 Posted January 13, 2016 Author Share Posted January 13, 2016 11 hours ago, drhayes said: thx !! :-D I'll have a try and report my test later . :-D Link to comment Share on other sites More sharing options...
leaf37 Posted January 13, 2016 Author Share Posted January 13, 2016 It works !!Thx! drhayes 1 Link to comment Share on other sites More sharing options...
Recommended Posts