1 decade ago by Cadence96
Hi, I have Player and Coin entities. Both entities have a check method because I want to add a different condition for each.
Check in Coin works as expected when the Player touches it.
Check in Player doesn't do anything when the Player touches the Coin.
What can I do to make check method work in Player?
Here are the important parts of the code of both entities
Player Entity:
Coin Entity:
Check in Coin works as expected when the Player touches it.
Check in Player doesn't do anything when the Player touches the Coin.
What can I do to make check method work in Player?
Here are the important parts of the code of both entities
Player Entity:
EntityPlayer = ig.Entity.extend({ type: ig.Entity.TYPE.A, checkAgainst: ig.Entity.TYPE.NONE, collides: ig.Entity.COLLIDES.PASSIVE, // init, update, etc check: function(other) { if (other instanceof EntityCoin) { console.log('EntityPlayer touched EntityCoin'); } },
Coin Entity:
EntityCoin = ig.Entity.extend({ type: ig.Entity.TYPE.NONE, checkAgainst: ig.Entity.TYPE.A, collides: ig.Entity.COLLIDES.NEVER, // init, update, etc check: function(other) { if (other instanceof EntityPlayer) { console.log('EntityCoin has been touched by EntityPlayer'); } }