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 RationalGaze

Hi there,

i would like to create a function in my main.js which is able to manage "collisions" between my entities. I call it fake collisions because my entities just go from a position to another position, they dont have any speed/velocity and collisions properties are useless then.

the idea behind this function would be like comparing two positions on the Y axis (or X) and decide how entities would react.

but my game is a tetris like, so among those two entities one doesn't move and one is falling.

the difficulty is to make act these entities like if they were colliding.

1 decade ago by Joncom

Sounds like what you want to do is move blocks instantly but only if you know beforehand that a collision will not take place in doing so.

Should be easy enough to do. Assuming you're only talking about entity-to-entity collisions, you can use Entity.distanceTo to figure out how far away a given block is.

So assuming also that your blocks move a constant distance each time, you should be able to tell if the next move will be close enough to collide.

1 decade ago by RationalGaze

Thanks a lot, i did some research about this method and i think it will do the job ;)
Page 1 of 1
« first « previous next › last »