Answer the question
In order to leave comments, you need to log in
How to know when to increase or decrease the coordinates of an object when colliding with another?
Here I tried to implement it, but one side is junk and the object is purposefully, uncontrollably moving through the other.
It should work like this:
If the object collided from above - subtract Y, if from below - add Y.
Similarly with X.
Thanks in advance.
if(blob.pos.x+blob.r/2+10 > block[i].pos.x && blob.pos.x < block[i].pos.x+blockbg.width+blob.r-10 && blob.pos.y > block[i].pos.y-blob.r+10 && blob.pos.y < block[i].pos.y+blockbg.height+blob.r-10) {
mouseX = blob.pos.x;
mouseY = blob.pos.y;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question