Sdorova Posted July 10, 2017 Share Posted July 10, 2017 Character fall through the ground although i use function setCollision. Here is my code main.js Here is map newmap.json Please help Link to comment Share on other sites More sharing options...
ncil Posted July 10, 2017 Share Posted July 10, 2017 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 More sharing options...
Sdorova Posted July 10, 2017 Author Share Posted July 10, 2017 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(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 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 More sharing options...
ncil Posted July 10, 2017 Share Posted July 10, 2017 Oh, bummer. Are you getting any console errors? Link to comment Share on other sites More sharing options...
Sdorova Posted July 10, 2017 Author Share Posted July 10, 2017 3 minutes ago, ncil said: Oh, bummer. Are you getting any console errors? Unfortunately no Link to comment Share on other sites More sharing options...
WombatTurkey Posted July 10, 2017 Share Posted July 10, 2017 Nasty.. nasty bug in tiled or phaser (don't know which one is reporting it) 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 Link to comment Share on other sites More sharing options...
samme Posted July 10, 2017 Share Posted July 10, 2017 Try removing layer.scale.set. Sdorova 1 Link to comment Share on other sites More sharing options...
Sdorova Posted July 10, 2017 Author Share Posted July 10, 2017 43 minutes ago, WombatTurkey said: Nasty.. nasty bug in tiled or phaser (don't know which one is reporting it) 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 Link to comment Share on other sites More sharing options...
Sdorova Posted July 10, 2017 Author Share Posted July 10, 2017 In .json file i see id 9, so setCollision must take 9 Link to comment Share on other sites More sharing options...
WombatTurkey Posted July 10, 2017 Share Posted July 10, 2017 wait, how many layers do you have in your tiled editor, just one right? Link to comment Share on other sites More sharing options...
Sdorova Posted July 10, 2017 Author Share Posted July 10, 2017 1 minute ago, WombatTurkey said: wait, how many layers do you have in your tiled editor, just one right? right Link to comment Share on other sites More sharing options...
Sdorova Posted July 10, 2017 Author Share Posted July 10, 2017 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 Link to comment Share on other sites More sharing options...
WombatTurkey Posted July 10, 2017 Share Posted July 10, 2017 Well, if scale is off.. those tiles are what you get from your texture Just need to use a different tileset if you want larger ones Glad u got it working, looks like sammy won hehe Sdorova 1 Link to comment Share on other sites More sharing options...
Sdorova Posted July 10, 2017 Author Share Posted July 10, 2017 Thanks to everyone Link to comment Share on other sites More sharing options...
ncil Posted July 10, 2017 Share Posted July 10, 2017 Just now, Sdorova said: Thanks to everyone Glad you got it working! So the problem was just layer.scale and maybe Edge? Link to comment Share on other sites More sharing options...
Sdorova Posted July 10, 2017 Author Share Posted July 10, 2017 Just now, ncil said: Glad you got it working! So the problem was just layer.scale and maybe Edge? Yes, because of this there was a problem Link to comment Share on other sites More sharing options...
WombatTurkey Posted July 10, 2017 Share Posted July 10, 2017 13 minutes ago, Sdorova said: Yes, because of this there was a problem dumb cookies anyway! Sdorova 1 Link to comment Share on other sites More sharing options...
Recommended Posts