Jump to content

Collisions doesn't work


Sdorova
 Share

Recommended Posts

I have no experience with tilemaps but I took a minute to look through your code and have a suggestion...

map.setCollision(9, true);

For that first argument it's expecting a number or an array, you're giving it an array with one value. Did you try just doing 9 instead of [9]? Again I'm not sure but it seems like 9 would mean "all tiles with an ID of 9" and [9] would mean "the 9th tile in the map".

Give that a shot and let me know if it works... :)

Reference: https://phaser.io/docs/2.4.4/Phaser.Tilemap.html#setCollision

Link to comment
Share on other sites

10 minutes ago, ncil said:

I have no experience with tilemaps but I took a minute to look through your code and have a suggestion...


map.setCollision(9true);

For that first argument it's expecting a number or an array, you're giving it an array with one value. Did you try just doing 9 instead of [9]? Again I'm not sure but it seems like 9 would mean "all tiles with an ID of 9" and [9] would mean "the 9th tile in the map".

Give that a shot and let me know if it works... :)

Reference: https://phaser.io/docs/2.4.4/Phaser.Tilemap.html#setCollision

Yes, before, I was already trying to replace [9] by 9, but this did not give a positive result 

Link to comment
Share on other sites

43 minutes ago, WombatTurkey said:

Nasty.. nasty bug in tiled or phaser (don't know which one is reporting it)

 

be0712b3a53b41cd7d12056034e3d5bb.png

 

 

Add one to your tile index... (setCollision(idnumber+1)) fixes it for me

took me forever to isolate this lol. had to look in console 

 

24 minutes ago, samme said:

Try removing layer.scale.set.

Adding a +1(map.setCollision(10)) does not help, removing layer.scale.set. too :blink:

Link to comment
Share on other sites

Oh, when I ran the game with the Chrome browser (I used Edge earlier) and removed layer.scale.set (2); and deleted the cookies all started working, but how now to increase the size of the tiles? Tiles are too small

Снимок.PNG

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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