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

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...