Snake game - Getting collision to work with images
<p>This works when I used a rectangle as the food but now I'm trying to use my own image for the food but can't get it to work correctly. I keep getting the error of "Cannot convert Image to Rectangle" when using <code>IntersectsWith</code> so I'm stuck there and not sure what to do. </p>

<p>My error is on this part of the code:<code>if (snake.SnakeRec[i].IntersectsWith(food.foodRec))</code></p>

<pre><code>for (int i = 0; i &lt; snake.SnakeRec.Length; i++)
        {
            if (snake.SnakeRec[i].IntersectsWith(food.foodRec))
            {
                score += 10;
                snake.growSnake();
                food.foodLocation(randFood);
            }
        } 
        collision();

        this.Invalidate();
</code></pre>

<p>In the Food.cs class</p>

<pre><code>public void drawFood(Graphics paper)
    {
        Image foodRec = Image.FromFile(@"C:\food.bmp"); 
        Rectangle rectangleAreaToDrawImage = new Rectangle(x, y, width, height);

        paper.DrawImage(foodRec, rectangleAreaToDrawImage);
    }
</code></pre>

<p>If you need more code let me know.</p>

<p>Edit: Solved</p>

<p>I had to change:</p>

<p><code>if (snake.SnakeRec[i].IntersectsWith(food.foodRec))</code></p>

<p><code>Rectangle rectangleAreaToDrawImage = new Rectangle(x, y, width, height);</code></p>

<p>to:</p>

<p><code>if (snake.SnakeRec[i].IntersectsWith(food.rectangleAreaToDrawImage))</code></p>

<p><code>rectangleAreaToDrawImage = new Rectangle(x, y, width, height);</code></p>
