I have 2 pictures (TImage). One does not move, and the second moves to the first (only along the X axis)
I did something like this: return (b->Left <= (a->Left + Width));
But it does not work as it should.
How to make a collision check?
|
1 answer
all right you think you need to make sure that - the X coordinate of the second picture was not equal or less (X coordinate + width of the first picture), that is, you probably have a mistake in the code.
bool check(float xFirstImg, float xSecondImg, float widthFirstImg){ if(xSecondImg <= (xFirstImg + widthFirstImg)){ return true; return false; } |