I am doing with following code, where samosarect is one object which coming from right to left with some speed(suppose 10px per loop), tonguerect is my player's tongue which increases up to 200 width and again decreases to 0. Tongue only increases when tongue is true,tongue boolean becomes true when I press shoot button.So my problem is sometimes my player(tonguerect) don't eat(doesnt intersect with samosarect) the samosa(I watch with my eyes that rectangles are intersecting but my code is not getting that),sometimes it(intersecting with proper anim ) eats the samosa without any problem.
if (Texture.samosarect.Contains(Texture.tonguerect) || Texture.tonguerect.Intersects(Texture.samosarect) && tongue)
{
Texture.tonguerect.Y = -50;
System.Diagnostics.Debug.WriteLine("eated samosaaa");
Texture.samosarect.X = -400;
eateds = true;
jumpframe = 17;
tonguereached = true;
caught = true;
if (MainPage.togkey == 1)
eateffect.Play();
if (!catchedd)
{
score += 30; catched++; catchedd = true;
showpoint = true;
}
else { catchedd = false; }
}