Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by dmen

I have a bullet entity like so:

EntityBullet = ig.Entity.extend({

collides: ig.Entity.COLLIDES.PASSIVE,
checkAgainst: ig.Entity.TYPE.B,

and I have a check function declared after update:

check: function (other) {
alert('check'+other);
this.parent();
},


Then I have a tree entity. It's set like so:

collides: ig.Entity.COLLIDES.FIXED,
type: ig.Entity.TYPE.B,

So, tree's type is B and bullet collidesWith type B... however I never get a trace with ig.log or an alert as shown...

What am I doing wrong?

1 decade ago by dmen

PS - the bullet bounces off the tree, so I know collisions are working. I just want to resolve the collision differently and so need the check function

1 decade ago by dominic

Use .type and .checkAgainst to specify if and how Entities get checkd.

.collides only concerns collisions. Entities that collide with each other don't overlap. If you want to react to collisions, overwrite .collideWith - it's called after a collision was resolved.

1 decade ago by dmen

Thanks much Dominic. Using collideWith worked perfect.
Page 1 of 1
« first « previous next › last »