Jump to content

how to trigger collide (seperate) function on tileCallBack?


Recommended Posts

So I have dozens of tileset ID's for background, water, and walls. Id really love to do something like this,


Where waterCollide calls the sprites instance of waterCollide , and the sprite determines whether or not it wants to collide.


I can't call collide, and i've tried to call game.physics.arcade.separateTile(1,sprite,tile); but it then seems to loop back through the indexCallback again and the second time through the tile is null. Im pretty sure its due to this line in world.js


Id like to have this so I could have people not walk on water, but bullets to fly over water. Or any combination. I could do this with a processCallback, but it seems like a dirtier way to go about it. I would have to check the tile ID against the values of every tile of water or wall. 


Edit: Now that i'm trying, even using this : 

this.game.physics.arcade.collide(this.entityGroup, this.layer,null ,this.checkCollision,this);

And even when the checkCollision returns false, the collision and seperation still happens.


Edit : Good news worse news Updated from 2.0.5 to 2.1.1, when checkCollision returns false, the seperation dosnt happen, so I'm using it like this. However... Even when the sprite isn't colliding with anything... It does the checkCollision every frame... which is a problem (It wasnt doing it in 2.0.5)

Link to comment
Share on other sites


  • Recently Browsing   0 members

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