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 PopaSmurf

I'm trying to move an entity around with the mouse but whenever I take it to the border of the map it doesn't stop me overlapping.

I'm using this to control the movement
this.pos.y = ig.input.mouse.y - this.size.y/2;
this.pos.x = ig.input.mouse.x - this.size.x/2;

That works fine, just the overlapping of a solid boundary that doesn't. I looked in to mapping the solid blocks myself but I don't understand it.

Thanks in advanced!

1 decade ago by mohd874

I am having the same problem. Did you find a solution for that?

1 decade ago by dominic

If you set the position of the entity directly, it will override all collision detection. After all, you're basically "teleporting" the entity to the new position.

Try setting the entity's velocity instead, so that it moves towards the mouse pointer. This will account for the collision layer and stop the entity at solid tiles.
Page 1 of 1
« first « previous next › last »