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

9 years ago by philpill

Hi,

I'm trying to work out why two Player entities won't collide:

        type: ig.Entity.TYPE.A,

        collides: ig.Entity.COLLIDES.ACTIVE,

        checkAgainst: ig.Entity.TYPE.BOTH,

against:

        type: ig.Entity.TYPE.B,

        collides: ig.Entity.COLLIDES.PASSIVE,

        checkAgainst: ig.Entity.TYPE.A,

I get intersectWith() results, but collideWith() and check() are never hit on either entity. I've tried combinations of different property values (A, B, PASSIVE, LITE, etc) with no luck.

Not sure if it's relevant, but I'm also using impact++.

I've tried using the debug module to check out the hitboxes, but it doesn't seem to work properly for me - the elements render correctly on the screen, but nothing ever draws on the graphs and no debug info is ever shown in the game. Everything looks like it's running as it should be - I don't seem to be getting any js errors.

My main definition:
ig.module(
	'game.main'
)
.requires(
    'plusplus.core.plusplus',
    'game.managers.connection',
    'game.managers.level',
    'game.managers.ui',
    'game.entities.otherPlayer',
    'game.entities.player',
	'impact.game',
	'impact.font',
    'impact.input',
    'impact.debug.debug'
)
.defines(function(){

Please see http://i.imgur.com/Sblzh2o.gif

Any one any ideas for either problem?

9 years ago by philpill

Ah, for impact++, you need to use its own debug module

'plusplus.debug.debug'

9 years ago by philpill

Another &039;duh' moment ... use #ig.EntityExtended.COLLIDES instead of ig.Entity.COLLIDES

I also needed to use initTypes() to add type and checkAgainst

initTypes: function() {
    ig.utils.addType(ig.EntityExtended, this, 'type', 'OTHERPLAYER');
    ig.utils.addType(ig.EntityExtended, this, 'checkAgainst', 'PLAYER');
}
Page 1 of 1
« first « previous next › last »