Sdorova

Collisions doesn't work

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

Share this post


Link to post
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 

Share this post


Link to post
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:

Share this post


Link to post
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

Share this post


Link to post
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...

  • Recently Browsing   0 members

    No registered users viewing this page.