Hello,

I am trying to make a snake game in c#. Until now i have got a 'Red pictureBox' which moves according to the keys pressed and a Score Label.

Now i want to add the score when the "red PictureBox" collides with another pictureBox.

----------------------------------------

I tried something like this:

if(pictureBox1.Location == pictureBox.Location)
{
score++;
lbl_score.Text = score;

But it didn't seem to work. I mean, the score increased only when their center met. I want to add the score as soon as they collide.

Please help.

Thanks in advance.

Try pictureBox.Bounds.IntersectsWith().
That should detect the edges of two objecs meeting.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.