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 Hareesun

I'm trying to make an entity that is above the regular collision layer and ignores it completely. I've tried having a blank handleMovementTrace but it hasn't helped at all. Any suggestions?

Also, can someone clue me on how I can have said entity stick to the left hand side of the screen at all times? Thanks! :)

1 decade ago by MikeL

I had a partial solution here, but nefD has the correct answer right below.

1 decade ago by nefD

I had this problem with P-Shooter. You're on the right track. Here's what you want:

handleMovementTrace: function(res) {
    this.pos.x += this.vel.x * ig.system.tick;
    this.pos.y += this.vel.y * ig.system.tick;
}

So basically, you don't call parent, but you perform the movement that parent would have performed without allowing it to adjust for collision.

1 decade ago by MikeL

Very nice nefD. That is a nice simple solution. Now my puck in pong has been properly converted into a flying saucer.

1 decade ago by Hareesun

Thanks for the help you guys :)

1 decade ago by Hazneliel

Hello, Im trying to do something similar, my entity is type A and must check against other type A and type B entities to collide, but on some cases I want to ignore collision when it overlaps another entity of the same type. I tried to use the code above in the check function like this:
 check: function(other) {
          if (other instanceof EntityBall) {
                this.pos.x += this.vel.x * ig.system.tick;
                this.pos.y += this.vel.y * ig.system.tick;
            }
        }

but the collision is still resolving. Any suggestion??

1 decade ago by dominic

The check() method is completely independent of collision detection. By default, chek() does nothing - so there's no behavior you could "opt-out" of.

Also, the entity&039;s #type and checkAgainst property do not specify if the entity will collide; they are only used for the check() method. To specify if and how an entity collides with other entities, use the .collides property.

What exactly are you trying to do in your game? Most of the time you shouldn&039;t need to code some extra behavior when you set the #.collides property carefully. E.g. two entities with ig.Entity.COLLIDES.PASSIVE won&039;t collide with each other, but will still collide with an entity that has #ig.Entity.COLLIDES.ACTIVE or ig.Entity.COLLIDES.FIXED.

1 decade ago by Hazneliel

I want my entity to collide normally except when it has some condition, like a power up that makes it ignore walls or enemies and just go trougth them.

1 decade ago by dominic

You can change the .collides property of the entity at any time. Just set it to ig.Entity.COLLIDES.NEVER when it has the powerup, and back to ACTIVE again (or whatever) when the powerup wears off.
Page 1 of 1
« first « previous next › last »