Jump to content

how to trigger collide (seperate) function on tileCallBack?


Lutcikaur
 Share

Recommended Posts

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

map.setTileIndexCallback([9,10,11,12,21,22,23,24,33,34,35,36,45,46,47,48],this.wallCollide,this);map.setTileIndexCallback([57,58,59,60,69,70,71,72,81,82,83,84,93,94,95,96],this.waterCollide,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

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